SplitView Pass from Master to Detail Issue


i trying convert ipad app using tab bar controller root view using split view controller it. code in appdelegate.h is:
code:
  @class rootviewipad;  @class webviewcontroller2;  @interface appdelegate : nsobject <uiapplicationdelegate, uisplitviewcontrollerdelegate> {  uiwindow *window;      uisplitviewcontroller *splitviewcontroller;    }    @property (nonatomic, retain) iboutlet uiwindow *window;  @property (nonatomic, retain) iboutlet uisplitviewcontroller *splitviewcontroller;  @end  
the .m is:
code:
  #import "appdelegate.h"  #import "webviewcontroller2.h"  @implementation appdelegate    @synthesize window;  @synthesize splitviewcontroller;    - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {                self.window.rootviewcontroller = self.splitviewcontroller;      [self.window makekeyandvisible];        return yes;  }  
i use ib set up, , added splitviewcontroller in mainwindow, , connected appdelegate connection splitviewcontroller splitviewcontroller added. under navigation controller in splitviewcontroller set root view rootviewipad (the tableview parses blog , shows articles), , set other view controller class , nib webviewcontroller2 articles display once clicked on. when run app, compiles, , can see webviewcontroller2 built in ib, , when rotate, left hand side tableview created. however, can't figure out how load url in webviewcontroller2. have tried either nothing, or merely pushes on master side of controller.
code:
  - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {        webviewcontroller2 *detailviewcontroller =       self.webviewcontroller2;        detailviewcontroller.webview.scalespagetofit = no;      rssentry *entry = [_allentries objectatindex:indexpath.row];        [detailviewcontroller.webview loadhtmlstring:entry.articleimage baseurl:[nsurl urlwithstring:nil]];      }      }  
any suggestions?
 

try grabbing viewcontroller attached detailview storyboard, instead of making new instance.
code:
  - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {        webviewcontroller2 *detailviewcontroller = (webveiwcontroller2 *)      [[self.splitviewcontroller.viewcontrollers lastobject] topviewcontroller];      //       ....      // pass data object selected row detail view.      [detailviewcontroller setdetailitem:[yourdatasource objectatindexpath:indexpath]];    }  
from there you'll need method on view controller accepts new data drives view , whats needed cause view redraw around view. haven't used web views not sure if method exists.
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

Comments

Popular posts from this blog

Rogue - the old text based game. I can't find it!

ATV3 5.1 channel ?

no service after redsnow jailbreaking