[問題] 請益從其他class獲取參數的方法
假設在MAC OS X開發應用APP下
我在A.h中宣告了
IBOutlet NSPopUpButton *popupBut;
並在A.m中寫了
NSString *select1 = [NSString stringWithFormat:@"%@",[popupBut titleOfSelectedItem];
請問如果我要在B.m中得到A.m的NSPopUpButton *popupBut的值
該怎麼寫才好?試了多次爬了一些文由A.m中得到的值都是NULL
謝謝!
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 60.248.134.2
※ 文章網址: https://www.ptt.cc/bbs/MacDev/M.1459148438.A.051.html
→
03/28 15:29, , 1F
03/28 15:29, 1F
→
03/28 15:56, , 2F
03/28 15:56, 2F
謝謝兩位幫忙,大概就是把A.h下宣告的NSPopUpButton在B.m中
取得NSPopUpButton裡面字串資訊這樣
比方說在A.h中宣告
IBOutlet NSPopUpButton *popupBut;
然後我在B.m中@import "A.h"後宣告
A *smA = [A alloc];
NSString *getstring =
[NSString stringWithFormat:@"%@",[smA.popupBut titleOfSelectedItem];
來讓getstring抓到A.h NSPopUpButton的值這樣
抱歉一開始沒有說得很清楚,謝謝!
※ 編輯: aureolus (60.248.134.2), 03/28/2016 17:41:03
→
03/28 18:41, , 3F
03/28 18:41, 3F
推
03/29 01:30, , 4F
03/29 01:30, 4F
→
03/29 09:20, , 5F
03/29 09:20, 5F
→
03/29 09:21, , 6F
03/29 09:21, 6F
→
03/29 09:25, , 7F
03/29 09:25, 7F
謝謝各位的幫忙,以用上述的方向成功解決了問題,謝謝大家!
※ 編輯: aureolus (60.248.134.2), 03/29/2016 13:34:13
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章