ios - Listview to uiwebview? -
i can create list of 5 websites in listview how this..
on clicking 1 of items in list should take me uiwebview display url within app button listview?
is there example or tutorial this?
thanks
attempt follows: (sites don't appear in table list - trying make them appear , clickable open internally in app)
a tableview named "sites" has been added tab on app.
tabcontroller.m
- (void)tableview:(uitableview *)sites didselectrowatindexpath:(nsindexpath *)indexpath { switch(indexpath.row) { case 0:[[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"www.google.com"]]; break; case 1:[[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"www.facebook.com"]]; break; case 2:[[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"www.google.com"]]; break; case 3:[[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"www.yahoo.com"]]; break; case 4:[[uiapplication sharedapplication] openurl:[nsurl urlwithstring:@"www.msn.com"]]; break; } } tabcontroller.h
@interface tabcontroller : uiviewcontroller { iboutlet uitableview *sites; }
load webview url
nsstring *urladdress = @”http://www.google.com”; //create url object. nsurl *url = [nsurl urlwithstring:urladdress]; //url requst object nsurlrequest *requestobj = [nsurlrequest requestwithurl:url]; //load request in uiwebview. [webview loadrequest:requestobj]; - create 2 viewcontrollers
- first populate tableview showing urls,
- one second vc add uiwebview , create iboutlet
- on did select tableview method push second viewcontroller ,pass url
- use above code in second view controller load webview url
Comments
Post a Comment