0

我有一个存储在数据库中的 URL,我正在使用导航控制器在表视图中检索它。当我单击表格单元格时,我希望该 URL 值进入我的详细视图控制器并打开一个uiwebview. 我怎样才能做到这一点?

4

1 回答 1

0

Have you tried adding a paramater the Detail ViewControllers init method? You could try passing it as a param there and storing it as a member. Then in the viewWillLoad function you can use it to set up your UIWebView.

@implementation DetailViewController 

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil URL:(NSString*)input
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        //class param to store the url 
        self.urlToUse = input;
    }
    return self;
}

-(void)viewDidLoad
{
     //setup UIWebView with urlToUse
     [super viewDidLoad];
}

//...
@end
于 2012-07-20T23:41:45.243 回答