ios - scrollview is not scrolling -
ios - scrollview is not scrolling -
this question has reply here:
uiscrollview not scrolling? 4 answersthis code of page trying implement . settings page game im working on. have created outerview (called outerview) contains scrollview , scrollview contains uiview has main content buttons , labels . having troubles getting scrollview scroll , downwards screen. help appreciated
@property (weak, nonatomic) iboutlet uiscrollview *scrollview; @property (weak, nonatomic) iboutlet uiview *containerview; @property (weak, nonatomic) iboutlet uiview *outerview; @end @implementation settingsviewcontroller #define music_key music #define sound_key sound -(void)viewdidload { [super viewdidload]; [self checkvalues]; [self makesettingspage]; } -(void)makesettingspage { [self.scrollview setcontentmode:uiviewcontentmodescaleaspectfit]; //content size size of view within scrollview self.scrollview.contentsize = cgsizemake(_outerview.frame.size.width,_outerview.frame.size.height); roundbutton *about=[[roundbutton alloc]initwithcolor:color1 withtext:@"about"]; roundbutton *privacypolicy=[[roundbutton alloc]initwithcolor:color2 withtext:@"privacy \n policy"]; roundbutton *termsofuse=[[roundbutton alloc]initwithcolor:color2 withtext:@"terms \n of use"]; about.center=cgpointmake(29, 451); privacypolicy.center=cgpointmake(29, 481); termsofuse.center=cgpointmake(29, 511); self.containerview.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagewithcontentsoffile:[[[nsbundle mainbundle] resourcepath] stringbyappendingpathcomponent:@"background_letter.png"]]]; [self.containerview addsubview:about]; [self.containerview addsubview:privacypolicy]; [self.containerview addsubview:termsofuse]; }
add setcontentsize viewwillappear or viewdidappear.
iboutlets created when view shown, not after loading.
you can verify adding breakpoint line. scroll view nil.
ios objective-c uiscrollview
Comments
Post a Comment