Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

iphone - Why do I have to subtract for height of UINavigationBar twice to get UIWebView to be correct size? -


i using uinavigationbar in app 3 different uiviewcontrollers. rootviewcontroller hides navigation bar when view on top of stack implementing following in rootviewcontroller.m:

- (void)viewwillappear:(bool)animated { [super viewwillappear:animated];  [self.navigationcontroller setnavigationbarhidden:true animated:true];} 

and

- (void)viewwilldisappear:(bool)animated { [super viewwilldisappear:animated];  [self.navigationcontroller setnavigationbarhidden:false animated:true];} 

when firstviewcontroller pushed top, works fine. in ib, told view has status bar , navigation bar. of subviews (added in ib) laid out expected on simulator , on device.

however, when secondviewcontoller pushed top, things weird. in ib, told view there status bar , navigation bar before. added uiwebview fill remainder of screen (verified dimensions of 320 x 416 in ib) , looks correct in ib. ran app on simulator , device, , uiwebview runs behind navigation bar if 320 x 460.

to fix problem, added code secondviewcontroller.m:

- (void)viewdidload { [super viewdidload];  [webview setframe:cgrectmake(0.0, 44.0, 320.0, 372.0)]; } 

and looks fine when running on simulator , device. isn't right! height 416, not 372. why did have subtract height of uinavigationbar twice? hack works, think there important i'm missing here need understand. ideas appreciated.

not entirely sure why you're having subtract height twice, can explain why have @ all.

basically, in viewdidload, view controller , associated view have no idea they'll used. means view has no superview. if set frame before view controller presented modally, added navigation stack, or presented in tab bar, view liable moved around , resized , kinds of crazy stuff. answer problem perform layout in viewwillappear: instead:

- (void)viewwillappear:(bool)animated {     [super viewwillappear:animated];      webview.frame = self.view.bounds; } 

that snippet of code adjust web view fill area taken view controller, , execute before presenting view on screen. when executes, self.view has been adjusted account navigation bar, tab bar, status bar, etc.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -