【发布时间】:2011-05-10 00:22:57
【问题描述】:
我看到的几乎所有示例都是用 IB 完成的,但我不想使用 IB。
我想要做的是,当用户选择表格中的一行时,UIWebView 将被推送到堆栈并加载该特定页面,同时保留标签栏和导航栏。我不希望浏览器的所有功能,而只是能够滚动浏览页面,因为我的应用程序的其余部分控制人们如何通过表格浏览网站。
所以我已经能够推送其他视图控制器,但使用相同方法推送 UIWebView 不起作用。
这是我目前所拥有的......
这是 Threads.h 文件
#import "ThreadContent.h"
#import <UIKit/UIKit.h>
@interface Threads : UITableViewController {
NSMutableArray *threadName;
NSMutableArray *threadTitle;
UIActivityIndicatorView *spinner;
NSOperationQueue *operationQueue;
UILabel *loadingLabel;
NSMutableDictionary *cachedForum;
NSMutableArray *forumID;
NSInteger *indexPathRowNumber;
NSMutableArray *threadID;
ThreadContent *threadContent;
}
@property (nonatomic, assign) NSMutableArray *forumID;
@property (nonatomic, assign) NSInteger *indexPathRowNumber;
@end
我尝试推送 UIWebView 的 Threads.m 文件的一部分
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"%i",indexPath.row);//get row number
NSLog(@"%@", [threadID objectAtIndex:indexPath.row]);//thread id
//forums.whirlpool.net.au/forum-replies.cfm?t=
//NSString *urlString = [NSString stringWithFormat:@"forums.whirlpool.net.au/forum-replies.cfm?t=%@", [threadID objectAtIndex:indexPath.row]];
threadContent = [[ThreadContent alloc] init];
[self.navigationController pushViewController:threadContent animated:YES];
}
我的 WebView 文件.. 我不知道该怎么做?我确实将它设为“UIWebView”子类,但如果我尝试将其推送到堆栈上,我会遇到崩溃,说它需要成为“UIViewController”子类。
【问题讨论】: