糯公尺團 重制「iPhone團購資訊客戶端」(三)

2021-07-08 20:53:02 字數 4629 閱讀 4924

乙個cell和乙個popover寫好之後,就可以進入主檢視的編輯了。

//檢視商品詳情的**

@property (nonatomic, strong) nsstring *gourl;

@property (nonatomic, strong) nsstring *shopname;

@property (nonatomic, strong) nsstring *shopaddress;

@property (nonatomic, strong) nsstring *shoplongitude;

@property (nonatomic, strong) nsstring *shoplatitude;

@property (nonatomic, strong) poptableviewcontroller *tableviewcontroller;

@property (nonatomic, strong) tspopovercontroller *popovercontroller;

@property (nonatomic, strong) xmlparser *tbxmlparser;

@property (nonatomic, strong) picprocessor *picprocessor;

- (ibaction)showmap:(id)sender;

@end

@implementation

firstviewcontroller

- (void)viewdidload

//*****************************************

//aqgridview

self

.gridview = [[aqgridview alloc] initwithframe:cgrectmake(0, 0, 375, 647)]; //初始化用iphone6的點陣

self

.gridview

.autoresizingmask = uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleheight;

self

.gridview

.autoresizessubviews = yes;

self

.gridview

.datasource = self;

self

.gridview

.delegate = self;

[self

.view addsubview:_gridview];

}//hud提示框

- (void)showhud

//移除hud專用

-(void)removehud

//gridview重新整理專用

- (void)gridreload

//支援全部方向旋轉

- (uiinte***ceorientationmask)supportedinte***ceorientations

#pragma mark - popover

//彈出第三方popover

-(void)showpopover:(id)sender forevent:(uievent*)event

//popover消失以及功能的實現

//糯公尺api,取回南京市當天銷售的商品

- (void)popoverdismiss

if ([_tableviewcontroller.city isequaltostring:@"澳門"])

if ([_tableviewcontroller.city isequaltostring:@"南京"])

}}#pragma mark - web request processing

//執行url請求

//請求結束

//請求出錯

#pragma mark - 解析xml呼叫

- (void)xmlparser:(nsdata *)data

arrays = [_tbxmlparser xmlparser:data];

[hud removefromsuperview];

[_gridview reloaddata];

}#pragma mark - aqgridviewdatasource

- (nsuinteger)numberofitemsingridview:(aqgridview *)gridview

- (aqgridviewcell *)gridview:(aqgridview *)gridview cellforitematindex:(nsuinteger)index

//取得每乙個字典

nsdictionary *dict = [arrays objectatindex:index];

//上標題

[cell.captionlabel settext:[dict objectforkey:_tbxmlparser.tb_title]];

[cell.imageview setimage:[self picprocess:[nsurl urlwithstring:[dict objectforkey:_tbxmlparser.tb_image]]]];

[cell.pricelabel settext:[dict objectforkey:_tbxmlparser.tb_price]];

//按鈕新增事件

//這裡設定tag標示是第幾個button

cell.imagebutton

.tag = index;

[cell.imagebutton addtarget:self action:@selector(showmap:) forcontrolevents:uicontroleventtouchupinside];

return cell;

}//每個顯示框大小,和cell大小一樣

- (cgsize)portraitgridcellsizeforgridview:(aqgridview *)gridview

#pragma mark - image processing

- (uiimage *)picprocess:(nsurl *)url

#pragma mark - aqgridviewdelegate implements

- (void)gridview:(aqgridview *)gridview didselectitematindex:(nsuinteger)index

#pragma mark - go map

//跳轉mapviewcontroller檢視

- (ibaction)showmap:(id)sender

#pragma mark - segue

- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender

if ([segue.identifier isequaltostring:@"showmap"])

}@end超長有沒有!只是很多應該放到businesslogiclayer中的functions並沒有拆出來……

[nsthread sleepfortimeinterval:1.5];

return

yes;}

好了,這樣就可以呈現有顏色的標題欄等東西了。

不知道到這裡主介面和一些能不能夠呈現和實現了?