简体   繁体   中英

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section?

If i needed more rows in one section than another, is there a code i could implement to do this?

I have 3 sections altogether but in one section i require 6 rows, in another only 3, and in the last perhaps 3 again.

Regards, Jon

You just implement the method in the title that returns a different number for different section .

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
   if (section == 0)
     return 6;
   else
     return 3;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM