疑問 NSArray 訪問問題

2021-09-06 09:50:32 字數 3327 閱讀 2324

.h檔案

#import

#import

"inte***cehelper.h

"#import

"quartzcore/quartzcore.h

"@inte***ce fanweiandleixingviewcontroller : uiviewcontroller

@property(nonatomic,retain)nsstring *strbtnname; //

標記那個按鈕被按下

@property(nonatomic,retain)nsstring *strtypename; //

標記模組的名字

@property(nonatomic,retain)nsarray *arrleixing; //問題根源,如果沒有這句,.m檔案中,除了

viewdidload 方法外,其它方法不能訪問arrleixing 變數。也就是說,只能用self.的方式來訪問這個陣列物件。難道全域性物件,必須都用self.的方式來訪問嗎?

-(ibaction)btnback:(id

)sender; -(ibaction)btnsubmitclicked:(id)sender; //

確定搜尋按鈕

//將json 格式的原始資料轉解析成資料字典 -(nsmutabledictionary *)dictionaryfromjsonformatoriginaldata:(nsstring *)stroriginal;

//將帶有去除json資料中的轉義字元 -(nsstring *)removeescapecodefromstring:(nsstring *)str;

@end

.m檔案

#import

"fanweiandleixingviewcontroller.h

"@inte***ce

fanweiandleixingviewcontroller ()

@end

@implementation

fanweiandleixingviewcontroller

@synthesize

strbtnname;

@synthesize

strtypename;

@synthesize

arrleixing;

- (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil

return

self;

}- (void

)viewdidload

if ([self.strbtnname isequaltostring:@"

leixing

"])

else

if([self.strtypename isequaltostring:@"

quanchengzhusu"])

else

if ([self.strtypename isequaltostring:@"

yule

"])

else

if ([self.strtypename isequaltostring:@"

jinanmeishi

"])

else

if ([self.strtypename isequaltostring:@"

jinangouwu

"])

self.arrleixing = [stroriginal componentsseparatedbystring:@","

]; rowcount =self.arrleixing.count;

for (int i=0; i)

}//初始化

commontableview = [[uitableview alloc]initwithframe:cgrectmake(10, 85, 300, 370

)]; commontableview.

delegate =self;

commontableview.datasource =self;

commontableview.layer.borderwidth = 1; //

為table view 設定邊框

commontableview.layer.bordercolor =[[uicolor grouptableviewbackgroundcolor]cgcolor];

commontableview.separatorcolor = [uicolor grouptableviewbackgroundcolor]; //

設定分割線的顏色

//[commontableview setbackgroundcolor:[uicolor blackcolor]];

[self.view addsubview:commontableview];

}- (void

)viewdidunload

-(bool)shouldautorotatetointe***ceorientation:(uiinte***ceorientation)inte***ceorientation

-(ibaction)btnback:(id

)sender

-(ibaction)btnsubmitclicked:(id)sender //

確定搜尋按鈕

#pragma -mark tableviewdelegatemethods

//組的個數

- (nsinteger)numberofsectionsintableview:(uitableview *)tableview

//行數

-(nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section

//各項的高

- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath

//每個單元行中的內容

-(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath

else

if ([self.strbtnname isequaltostring:@"

leixing"])

return

tvcell;

}

mysql遠端訪問問題

1 進入mysql,建立乙個新使用者xuys 格式 grant 許可權 on 資料庫名.表名 使用者 登入主機 identified by 使用者密碼 grant select,update,insert,delete on to xuys 192.168.88.234 identified by ...

解決github訪問問題

github這是個好地方。但是,上不去就蛋疼。今天github上不去,果斷f12下,看下network。發現裡面好多請求都是指向 github.global.ssl.fastly.net這個網域名稱的,然後請求都無法成功。想到了改hosts,於是cmd裡ping github.global.ssl....

跨域訪問問題

瀏覽器跨域 跨域問題 於瀏覽器的同源策略,瀏覽器為了提高 的安全性,在傳送ajax請求時,只有在當前頁面位址與請求位址的協議 網域名稱 埠號相同時才允許訪問,否則會被攔截。協議即通訊協議,比如我們現在常見的http和https,如果當前頁面位址使用http協議,請求的位址使用https協議,那麼這個...