[memo] iphone dev / table view sample code

app-sample1cap-buildc5

c-2

c6

—————

SimpleTableView.h :

c4

—————

SimpleTableView.m :

c3

—–
在 cellForRowAtIndexPath 加段 code :

    // --- 每個 cell 前加上 一個 icon
    UIImage *image = [UIImage imageNamed:@"favicon.ico"];
    cell.imageView.image = image;
    // 加上一個往下 點擊 的標示
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    //

—–
加上 user 點擊 cell 時的 event :

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *stateSelected = [listdata objectAtIndex:[indexPath row]];
    NSString *msg = [[NSString alloc] initWithFormat:@"You have selected %@ , # %i", stateSelected,  [indexPath row] ];
    NSLog(@"%@",msg );

}

Comments are closed.

Related URL:
  1. Garmin 310XT PK iPhone4 GPS location 精準度
  2. 2011 巴黎馬拉松 – 法國警局
  3. [open source] iPhone , UIImage and PhotosAlbum 上傳一個圖到 simulator 的相簿 PhotosAlbum sample code
  4. 試用 ADIDAS 的 micoach iPhone APP. 跑10K間歇 ( without heart rate monitor)
  5. sample iPhone screen snapshot
  6. [iPhone dev] 今天看到一個精巧的設計 / tableview / iPhone design pattern
  7. 幾個 iPhone dev 的 opensource site
  8. My iPhone 4 / iP 4
  9. @@ 是誰又亂丟箱子在我桌上啊. . .
  10. iPhone icon size / iPhone 人機介面建議守則