【发布时间】:2011-05-11 05:25:56
【问题描述】:
我需要在我的应用程序中使用 UITable View,它必须支持横向和纵向。
如果我直接从界面生成器中拖动 UItableview,那么我该如何准确控制它
如果不是,那么建议我以编程方式执行相同的操作。
谢谢 里兹万
【问题讨论】:
-
尝试接受你之前的回答
标签: objective-c xcode ipad uitableview orientation
我需要在我的应用程序中使用 UITable View,它必须支持横向和纵向。
如果我直接从界面生成器中拖动 UItableview,那么我该如何准确控制它
如果不是,那么建议我以编程方式执行相同的操作。
谢谢 里兹万
【问题讨论】:
标签: objective-c xcode ipad uitableview orientation
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;//Returns the no of sections in the tableview
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 5;//Returns the no of rows in the tableview
}
//This method is called everytime when a row is created.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
cell.textLabel.text =@"tableview";
return cell;
}
【讨论】: