macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

-tableView:numberOfRowsInSection:

INDEX>UIKit>UITableViewDataSource

それぞれのセクションに項目がどれくらいあるのかを返します。
-(NSInteger)tableView:(UITableView *)tableView
                numberOfRowsInSection:(NSInteger)section

解説

それぞれのセクションに項目がどれくらいあるのかを返します。

返り値

( NSInteger )

引数

( UITableView * )tableView
( NSInteger )section

クラス

UITableViewDataSource

Instance Methods

使用可能

iPhone2.0

参照

例文

//それぞれのセクションに項目がどれくらいあるのか
- (NSInteger)tableView:(UITableView *)tv numberOfRowsInSection:(NSInteger)section {
    // Only one row for each section
	switch (section) {
        case 0: return 1; break;
        case 1: return 3; break;
        case 2: return 2; break;
    }
	
    return 5;
}