ios5 - ios 5 UIWebView show rows from UITableView -
this week started learning ios coding i'm getting strange error have made little script witch have on main page list of names made uitableview
, when select row it's open relative url, when load webpage goes wrong webpage have rows 'uitableview'.
did u know why it's generate kind of error?
that it's generate;
update have re-writed app proble still present, don't understand why show rows on webpage
in rootviewcontroller.m call webpage class
- (void) tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath{ nsdictionary *game = [[self.sections valueforkey:[[[self.sections allkeys] sortedarrayusingselector:@selector(localizedcaseinsensitivecompare:)] objectatindex:indexpath.section]] objectatindex:indexpath.row]; [tableview deselectrowatindexpath:indexpath animated:yes]; //svanisce il blu nslog(@"%@", [[self.games objectatindex:indexpath.row ] objectforkey:@"url"]); // funge webpage *newweb = [[webpage alloc] init]; newweb.theurl = [nsurl urlwithstring:[game objectforkey:@"url"]]; [self.navigationcontroller pushviewcontroller:newweb animated:yes]; }
that webpage.h
#import <uikit/uikit.h> @interface webpage : uitableviewcontroller <uiwebviewdelegate> { uiwebview *webview; nsurl *theurl; } @property (nonatomic, retain) nsurl *theurl; @property (nonatomic, retain) uiwebview *webview; @end
and webpage.m
#import "webpage.h" @implementation webpage @synthesize theurl; @synthesize webview; - (void)viewdidload { [super viewdidload]; webview = [[uiwebview alloc] initwithframe:cgrectmake(0,0, self.view.bounds.size.width, self.view.bounds.size.height)]; webview.delegate = self; webview.scalespagetofit = yes; [webview loadrequest:[nsurlrequest requestwithurl:theurl]]; [self.view addsubview:webview]; } @end
it because webpage class derived uitableviewcontroller
. instead derive uiviewcontroller
.
eg
@interface webpage : uiviewcontroller <uiwebviewdelegate> { uiwebview *webview; nsurl *theurl; }
Comments
Post a Comment