如何将UITextView添加到UITableView细节
问题描述:
需要一些帮助来弄清楚如何将一些文本(UITextView?)添加到UITableView细节视图。屏幕截图显示了我需要添加UITextView的空白空间。如何将UITextView添加到UITableView细节
这里是什么,我有一个截图:
这里就是我分配的UITableView细节称号值的方法。
//MainViewControler.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIViewController *detailsViewController = [[UIViewController alloc] init];
// get detail view controller "title" value
detailsViewController.title = word.term;
[[self navigationController] pushViewController:detailsViewController animated:YES];
[detailsViewController release];
}
谢谢!
答
创建detailsViewController对象后,添加以下代码:
UITextView *txtView = [[UITextView alloc] init];
txtView.text = @"UITextView text";
txtView.frame = CGRectMake(0,0,320,100);
[detailsViewController.view addSubview:txtView];
[txtView release];
txtView = nil;
答
如果通过单击上一页TableView中得到这个页面, 然后做了添加UITextView中的以下内容:
- 转到Interface Builder。
- 将UITextView拖到您的视图(当前视图,您在快照中显示)。
- 将视图的委托连接到文件的所有者。
- 您可以从IB或运行时在UITextView中添加代码。
希望它有帮助。 祝你好运。
答
UITextView *yourView =[[UITextView alloc] initWithFrame : CGRectMake(15,15,250,300)]autorelease]; // you can alter the frame values.
[detailsViewController.view addsubview : yourView]
我已经添加了所有这些代码从打字..我可以确认其正确的语法..使用自动完成。
+0
非常感谢! – Slinky 2012-02-06 17:57:37
你的意思是当你点击UITableView Cell时,你会得到这个页面的权利? – Krishna 2012-02-06 17:40:11
对,你是:-) – Slinky 2012-02-06 17:54:56