UITableView的完整製作

2021-07-02 22:57:19 字數 2927 閱讀 8982

//

//  viewcontroller.m

//  tab bar controllre

////  created by 紅珊瑚 on 15/5/21.

//#import "viewcontroller.h"

#import "uibutton+webcache.h"

#import "uiimageview+webcache.h"

#define kbuttonarray @"buttonarray"

#define ktitle1 @"title1"

#define ktitle2 @"title2"

#define ktitle3 @"title3"

@inte***ce

viewcontroller

()@end

@implementation viewcontroller

- (void)viewdidload,@,

@];*///左右滑動的地方

scroll

= [[

uiscrollview

alloc]initwithframe:cgrectmake(2,

2,318,

217)];

scroll

.pagingenabled=

yes;

scroll

.backgroundcolor= [

uicolor

whitecolor];

scroll1

= [[

uiscrollview

alloc]initwithframe:cgrectmake(2,

2,316,

217)];

scroll1

.backgroundcolor= [

uicolor

whitecolor];

scroll2

= [[

uiscrollview

alloc]initwithframe:cgrectmake(2,

2,316,

217)];

scroll2

.backgroundcolor= [

uicolor

whitecolor];

scroll3

= [[

uiscrollview

alloc]initwithframe:cgrectmake(2,

2,316,

217)];

scroll3

.backgroundcolor= [

uicolor

whitecolor];

//    //標頭

//    uilabel *labela = [[uilabel alloc] initwithframe:cgrectmake(100, 18, 120, 31)];

//    labela.text = @"奢侈品網購平台";

//    [self.view addsubview:labela];

}//改變cell間距

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

if (indexpath.row ==0)

break;

case

1:if (indexpath.row ==0)

else

if (indexpath.row ==1)

break;

case

2:if (indexpath.row ==0)

else

if (indexpath.row ==1)

break;

case

3:if (indexpath.row ==0)

else

if (indexpath.row ==1)

break;

}return

40;}

//共四組

-(nsinteger)numberofsectionsintableview:(uitableview *)tableview

//每組兩個

-(nsinteger)tableview:(uitableview *)tableview

numberofrowsinsection:(nsinteger)section

//顯示每個cell的內容

-(uitableviewcell*)tableview:(uitableviewcell*)tableview

cellforrowatindexpath:(nsindexpath *)indexpath

else

if (indexpath.row ==0)

else

if (button6.tag ==2)

else

if (button6.tag ==3)

else

if (button6.tag ==4)}}

}break;

case

1:else

if (indexpath.row ==1)}}

break;

case

2:else

if (indexpath.row ==1)}}

break;

case

3:else

if (indexpath.row ==1)}}

break;

}return cell;

//bool ii=  [self dbhyuvbin:nil arr:nil];   //自定義方法 (部分)

}//-(bool)dbhyuvbin: (nsstring *)str arr:(nsarray*)arr //自定義方法 (部分)

//@end

UITableView的詳細講解

1.uitableview的初始化 csharp view plain copy uitableview tableview uitableview alloc initwithframe cgrectmake 0,0,320,420 tableview setdelegate self table...

UITableView 索引的新增

1 自定義索引 準備資料,設計乙個陣列,陣列裡面的元素為每個section的陣列。返回section總數 nsinteger numberofsectionsintableview uitableview tableview 返回每個section的行數 nsinteger tableview ui...

UITableView 的行刪除

uitableview 編輯模式 created by mj on 13 4 11.import mjviewcontroller.h inte ce mjviewcontroller property nonatomic,retain nsmutablearray data end impleme...