2011-08-05 4 views
-1

私は既にたくさんのゲームアプリと音楽アプリを作っています。しかし、それらのどれもがテーブルビューを使用していませんでした。最近、私はテーブルビューに基づいてアプリの良いアイデアを得た。私の問題は:私はtableviewの知識が0です!Iphone SDK:Tableviewチュートリアル?

良いテーブルビューのチュートリアルが分かっている場合は、教えてください:)。私はテーブルビューについてすべてを学びたい。また、テーブルセルの詳細テキストを使用する方法と、セルをカスタマイズする方法も知りたいと思います。

Tanks in advance!

+5

iOS開発の経験がある場合は、Appleのマニュアルに気付かないでください。 – KingofBliss

+0

ええ...私はそれを使用する方法を持っていないいくつかを読んで:) – DailyDoggy

答えて

-1
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
    { 
     return 1; 
    } 
    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
    { 
     return 100; 
    } 

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
    { 
     return arr_finallistoffb.count; 
    } 

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
    { 
     static NSString *CellIdentifier = @"WhispersCell"; 
     WhispersCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

     if (!cell) { 
      cell = [[WhispersCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 
      cell.textLabel.textColor = [UIColor darkGrayColor]; 
     } 

        int cellheight; 
      NSString *str_question=[NSString stringWithFormat:@"Status: %@",[resultArray objectAtIndex:indexPath.row]]; 
      UIFont *font_question = [UIFont fontWithName:@"Gotham-Medium" size:14.0]; 
      CGSize size12312 = [(str_question ? str_question : @"") sizeWithFont:font_question constrainedToSize:CGSizeMake(260.0f, MAXFLOAT) lineBreakMode:NSLineBreakByWordWrapping]; 
      cellheight=size12312.height+35; 
      NSString *str_answer=[NSString stringWithFormat:@"Status: %@",[arr_Answer_filters objectAtIndex:indexPath.row]]; 
      UIFont *font = [UIFont fontWithName:@"Gotham-Medium" size:14.0]; 
      CGSize size = [(str_answer ? str_answer : @"") sizeWithFont:font constrainedToSize:CGSizeMake(260.0f, MAXFLOAT) lineBreakMode:NSLineBreakByWordWrapping]; 
      cellheight=cellheight+size.height+20; 

     if ([[[arr_finallistoffb objectAtIndex:indexPath.row]valueForKey:@"int_id"] isEqualToString:[[NSUserDefaults standardUserDefaults] valueForKey:PREF_USER_ID]]) 
     { 
      cell.btn_CommentIcon.userInteractionEnabled=NO; 
      cell.plusbtnOutlet.userInteractionEnabled=NO; 
     } 
     else 
     { 
      cell.btn_CommentIcon.userInteractionEnabled=YES; 
      cell.plusbtnOutlet.userInteractionEnabled=YES; 

     } 

     cell.img_users.layer.borderWidth=3.0; 
     cell.img_users.layer.cornerRadius=cell.img_users.frame.size.height/2; 
     cell.lbl_UserName.text=[NSString stringWithFormat:@"%@",[[arr_finallistoffb objectAtIndex:indexPath.row] objectForKey:@"var_username"]]; 
     [cell.img_users.layer setBorderColor: [[UIColor colorWithRed:(12.0/255.0) green:(14.0/255.0) blue:(41.0/255.0) alpha:1.0] CGColor]]; 
     cell.img_users.layer.masksToBounds=YES; 


     [cell.img_users setImageWithURL:[APPDELEGATE getURLForMediumSizeImage:[[arr_finallistoffb objectAtIndex:indexPath.row]valueForKey:@"var_img"]] placeholderImage:[UIImage imageNamed:@"logoinofficiel"] usingActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; 


     cell.plusbtnOutlet.tag=indexPath.row; 
     [cell.plusbtnOutlet addTarget:self action:@selector(btn_add_culturellis:) forControlEvents:UIControlEventTouchUpInside]; 
     if ([[[arr_finallistoffb objectAtIndex:indexPath.row]valueForKey:@"is_follower"]integerValue]==1) 
     { 
      [cell.plusbtnOutlet setSelected:YES]; 

     } 
     else{ 

      [cell.plusbtnOutlet setSelected:NO]; 
     } 
     [cell.button_userselection addTarget:self action:@selector(btn_User_culturellis:) forControlEvents:UIControlEventTouchUpInside]; 

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{ 
    if ([segue.identifier isEqualToString:@"Overview_Register"]) 
    { 
     WDRegisterViewController *obj=(WDRegisterViewController *)[segue destinationViewController]; 
     [email protected]"Edit Profile"; 
     obj.isRegister=NO; 
    } 
} 

      [self performSegueWithIdentifier:@"Overview_Measure" sender:nil]; 



    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; 
    WDPeekViewController *Peek = (WDPeekViewController *)[sb instantiateViewControllerWithIdentifier:@"WDPeekViewController"]; 
[self.navigationController pushViewController:tabBarController animated:YES]; 

     cell.selectionStyle=UITableViewCellSelectionStyleNone; 
     return cell; 
    } 
関連する問題