2012年5月4日 星期五

2012/05/03 ios sdk4 學習之路001

建立聯絡人練習




--先匯入三項資料


// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 3;
//顯示三個資料
}

--將return 0 改變成 return 
--代表存三項資料




//讓儲存格顯示三個連絡人名稱
if (indexPath.row==0
{
cell.textLabel.text=@"ALL Contacts";
}
else  if (indexPath.row==1
{
cell.textLabel.text=@"Friends";
}
else if (indexPath.row==2
{
cell.textLabel.text=@"Work";
}
else 
{
NSLog(@"Warning:Error index!!");
}

--在ViewContorller所顯示的字



//設定儲存格右邊展開資料
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;




- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
self.title=@"Groups";
//改編標題





沒有留言:

張貼留言