iphone - replace current view with any existing new view -



iphone - replace current view with any existing new view -

in short phone call method viewswitchmanager class contains method switch current view on display different view.

-(void)replaceview:(uiview*)oldsubview withview:(uiview*)newsubview;

i trying implement following:

in project have 10 views have own .m , .h files. lets represent each view number 1 - 10.

each view contains 9 buttons allow user click button , app take user specified view depending on button clicked.

example:

so lets current view beingness displayed is: view1. on view1 there 9 buttons beingness displayed each correspond different view in app.

[2] [3] [4] [5] [6] [7] [8] [9] [10]

note: button1 missing responds view1 current view button1 not needed on view.

action: user clicks on button 6. method called separate class called viewswitchmanager replace view1 current view, view6 new view.

the new view view6 display again, buttons correspont different view in app so:

[1] [2] [3] [4] [5] [7] [8] [9] [10]

note: button6 missing responds view6 current view button6 not needed on view.

this trying achieve. ive tried different things maintain getting errors. @ 1 point sigbart error. i've had problems sending views parameters, problems obtaining current view , replacing new view , on. i've thought having navigation controller having looked @ looks daunting experience , dont want drill downwards different layers. simple 1 in 1 out view scheme great. lol

can please help me has taken lot of time! because problem took of time i've had repurchase license purchase more time quite funny.

any help much appreciated. give thanks in advance.

it sounds viewswitchmanager should descend uiviewcontroller, i'll phone call switchviewcontroller in illustration code below. has bland uiview view serve backdrop covered button-filled view.

after that, should simple matter of:

@implementation switchviewcontroller -(void) replaceview:(uiview*)oldsubview withview:(uiview*)newsubview { [[self view] addsubview:newsubview]; [oldview removefromsuperview]; } @end

i suspect problems less involved managing views managing memory. if don't retain elsewhere, [oldview removefromsuperview] release , deallocate old view.

two things can create sure code more solid. one, build analyzer (cmd-shift-a) , clean issues finds.

two, enable zombies. nszombieenabled causes objects deallocated kept in memory, marked "deallocated." if deallocated "zombie" object ever used, exception raised. after that, it's matter of determining why objects not beingness appropriately retained. here's how set nszombieenabled:

project -> edit active executable select "arguments" tab add "variables set in environment" name: nszombieenabled value: yes

iphone objective-c uiview views replace

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -