xcode - iPhone: Creating Scrolling Image/Text Views within Modal View Tab Bars -


i've begun objective-c , looking find way create iphone app launch main menu consisting of maybe around 8 or 9 buttons.

when buttons pressed link scrolling text view (containing few paragraphs of text) accompanying image @ top of screen, act "back" button return main menu. looking animate/behave modalview (where new view scrolls bottom of screen, , scrolls down when dismissed/back-button pressed).

i have got tab views working within modal view (which brought pressing button in main menu) , have worked out how assign custom icon each tab. i've added custom background each tab. though i'm still having trouble adding scrolling views each tab, can insert pictures , text programmatically. appreciate give me this..

thanks much!!

.h

    #import <uikit/uikit.h>  @interface masseurviewcontroller : uiviewcontroller {     uitabbarcontroller *tbc; }  -(ibaction)showheadtabbar; -(void)dismisstabbar;  @property (nonatomic, retain) uitabbarcontroller *tbc;  @end 

.m

#import "masseurviewcontroller.h"  @implementation masseurviewcontroller  @synthesize tbc;  //---implement possible tab bar views   -(ibaction)showheadtabbar{      //---define button      uiimage *backimage = [uiimage imagenamed:@"headbackbutton.png"];      uibutton *button = [uibutton buttonwithtype:uibuttontypecustom];     button.frame = cgrectmake(0.0f, 0.0f, backimage.size.width, backimage.size.height);     [button setimage:backimage forstate:uicontrolstatenormal];     [button addtarget:self action:@selector(dismisstabbar) forcontrolevents:uicontroleventtouchupinside];      uibutton *button2 = [uibutton buttonwithtype:uibuttontypecustom];     button2.frame = cgrectmake(0.0f, 0.0f, backimage.size.width, backimage.size.height);     [button2 setimage:backimage forstate:uicontrolstatenormal];     [button2 addtarget:self action:@selector(dismisstabbar) forcontrolevents:uicontroleventtouchupinside];      uibutton *button3 = [uibutton buttonwithtype:uibuttontypecustom];     button3.frame = cgrectmake(0.0f, 0.0f, backimage.size.width, backimage.size.height);     [button3 setimage:backimage forstate:uicontrolstatenormal];     [button3 addtarget:self action:@selector(dismisstabbar) forcontrolevents:uicontroleventtouchupinside];      //------------************tabs**************-------------------     //-------------------------------------------------------------      //---------------declare view controllers-----------     //---------------------------tab 1     uiviewcontroller *bluecontroller = [[uiviewcontroller alloc] initwithnibname:nil bundle:nil];     bluecontroller.title = @"blue";     bluecontroller.tabbaritem.image = [uiimage imagenamed:@"tabbar1.png"];     //---add tabs & tab names     [bluecontroller.view addsubview:button];     bluecontroller.view.backgroundcolor = [uicolor whitecolor];     bluecontroller.view.backgroundcolor = [[uicolor alloc] initwithpatternimage:[uiimage imagenamed:@"mainmenubkg.png"]];          //----tab 2     uiviewcontroller *redcontroller = [[uiviewcontroller alloc] initwithnibname:nil bundle:nil];     redcontroller.view.backgroundcolor = [uicolor graycolor];     redcontroller.view.backgroundcolor = [[uicolor alloc] initwithpatternimage:[uiimage imagenamed:@"shouldersimage1.png"]];            //----tab 3     uiviewcontroller *greencontroller = [[uiviewcontroller alloc] initwithnibname:nil bundle:nil];     greencontroller.view.backgroundcolor = [uicolor greencolor];     //--------------------------------------------------       //---instantiate tab bars      tbc = [[uitabbarcontroller alloc] initwithnibname:nil bundle:nil];      //---create array of tabs     tbc.viewcontrollers = [nsarray arraywithobjects:bluecontroller, redcontroller, greencontroller, nil];      //---select starting tab     tbc.selectedviewcontroller = bluecontroller;      //--------------------------------------------------       //---add tabs & tab names      [redcontroller.view addsubview:button2];     redcontroller.title = @"red";      [greencontroller.view addsubview:button3];     greencontroller.title = @"green";       //---release tab views     [bluecontroller release];     [redcontroller release];     [greencontroller release];     [self presentmodalviewcontroller:tbc animated:yes];   }  //---code dismiss tab bars - (void)dismisstabbar {     [self dismissmodalviewcontrolleranimated:yes];     [tbc release]; }   /* // designated initializer. override perform setup required before view loaded. - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {     self = [super initwithnibname:nibnameornil bundle:nibbundleornil];     if (self) {         // custom initialization     }     return self; } */  /* // implement loadview create view hierarchy programmatically, without using nib. - (void)loadview { } */   /* // implement viewdidload additional setup after loading view, typically nib. - (void)viewdidload {     [super viewdidload]; } */   /* // override allow orientations other default portrait orientation. - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation {     // return yes supported orientations     return (interfaceorientation == uiinterfaceorientationportrait); } */  - (void)didreceivememorywarning {     // releases view if doesn't have superview.     [super didreceivememorywarning];      // release cached data, images, etc aren't in use. }  - (void)viewdidunload {     // release retained subviews of main view.     // e.g. self.myoutlet = nil; }   - (void)dealloc {     [super dealloc]; }  @end 

your question general illicit answer, i'll try point in right direction.

you not have create separate .h/.m/.xib each button - want main menu page buttons controlled single view controller class (.h, .m) , convenient create buttons in single .xib file.

the views create each button's action depends on want do. if 3 of them show image, re-use class called displayimageview, example.

i suggest app working single main view single button , action, , figure out how expand 8 or 9 actions.

and finally, think have lot of reading do. here place start. luck.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -