#import "SZViewController.h"
@interface SZViewController ()<UITableViewDataSource,UITableViewDelegate>
{
? ? UITableView *tb;
}
@end
@implementation SZViewController
- (void)viewDidLoad {
? ? [super viewDidLoad];
? ? self.title=@"設(shè)置";
? ? tb=[[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStyleGrouped];
? ? tb.dataSource=self;
? ? tb.delegate=self;
? ? [self.view addSubview:tb];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView*)tableView{
? ? return 2;
}
-(NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section{
? ? if(section ==0) {
? ? ? ? return 9;
? ? }
? ? else {
? ? ? ? return 1;
? ? }
}
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{
? ? UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:@"2"];
? ? if(!cell) {
? ? ? ? cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"2"];
? ? }
? ? if(indexPath.section==0) {
? ? ? ? tb.rowHeight=40;
? ? ? ? NSArray *arr;
? ? ? ? arr = [NSArray arrayWithObjects:@"個人資料",@"賬戶與安全",@"我的地址",@"意見反饋",@"賬號與s設(shè)備安全",@"證件信息",@"推送通知",@"清除緩存",@"關(guān)于貝店", nil];
? ? ? ? cell.textLabel.text=arr[indexPath.row];
? ? }
? ? else{
? ? ? ? UILabel *lb =[[UILabel alloc]initWithFrame:CGRectMake((self.view.frame.size.width-80)/2,0,80,40)];
? ? ? ? lb.text=@"退出登錄";
? ? ? ? lb.textColor=[UIColor redColor];
? ? ? ? [cell addSubview:lb];
? ? }
? ? return cell;
}
@end