uitabbarcontroller + uitableviewcontroller +界面视图控制器
我正在使用从 URL http:// www.iphonemusings.com/2009/01/iphone-programming-tutorial-creating.html 显示带有选项卡栏的初始屏幕,并在两个选项卡中都有表格视图。 在表视图委托中进行必要的更改后,它也会在单元格中显示文本。 现在我想在单击表视图时显示一个视图。我正在使用以下代码。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Latest* evnt = (Latest*)[latestArray objectAtIndex:indexPath.row];
NSString* url = [evnt URLLink];
DetailedView* dv = [[DetailedView alloc] init];
[dv.label setText=@"Testing label"];
[self.navigationController pushViewController:dv animated:YES];
[dv release];
}
但它不显示任何文本。有人可以帮助我指出我的代码中有什么错误吗???
I'm using the code extracted from the URL http://www.iphonemusings.com/2009/01/iphone-programming-tutorial-creating.html to show initial screen with tab bar and having table view in both the tabs.
It is displaying the text in cells as well after taking necessary changes in table view delegate.
Now I want to show a view on click of table view. I'm using following code.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
Latest* evnt = (Latest*)[latestArray objectAtIndex:indexPath.row];
NSString* url = [evnt URLLink];
DetailedView* dv = [[DetailedView alloc] init];
[dv.label setText=@"Testing label"];
[self.navigationController pushViewController:dv animated:YES];
[dv release];
}
But it is not displaying any text. Can some one help me by pointing what mistake is in my code???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这能编译吗?
[dv.label setText=@"测试标签"];
不是 Objective-C。它应该是:Does this compile?
[dv.label setText=@"Testing label"];
is not Objective-C. It should read:复制所有这些代码并将其粘贴到现有的位置即可工作。
copy all this code and paste it at existing it will work.
试试这个代码。该代码将显示带有两个选项卡的
UITabBarController
。您可以在两个选项卡中创建表。在didSelectRowAtIndexPath
中,编写使用navigationController
推送视图的代码。当您在表中选择一行时,它将显示一个新视图。Try this code. The code will display
UITabBarController
with two tabs. You can create table in both tabs. IndidSelectRowAtIndexPath
, write code for push a view usingnavigationController
. When you select a row in the table it will display a new view.