Objective c 如何以编程方式创建表视图?
我需要在我的应用程序中使用UITable View,它必须支持横向和纵向 如果我直接从Interface builder中拖动UItableview,那么如何精确控制它 如果没有,那么建议我以编程的方式做同样的事情 谢谢Objective c 如何以编程方式创建表视图?,objective-c,xcode,ipad,uitableview,orientation,Objective C,Xcode,Ipad,Uitableview,Orientation,我需要在我的应用程序中使用UITable View,它必须支持横向和纵向 如果我直接从Interface builder中拖动UItableview,那么如何精确控制它 如果没有,那么建议我以编程的方式做同样的事情 谢谢 Rizwan试着接受你以前的回答 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1;//Returns the no of sections in t
Rizwan试着接受你以前的回答
- (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;
}