Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-31-2008, 04:55 PM   #1 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: Oceanside, CA
Posts: 570
Question App Delegate == > Calling its method from another view ?!??!?!?!

I know i asked this before, but this time i try to explain in more details.
In my app delegate I have 2 Forms (view controller with nib files)
I have methods in my app delegate which are being used to navigate through the forms.

For example in one of my forms i have a button that calls a method on my app delegate and it suppose to close the current view and open another one

Code:
@implementation Form1
- (IBAction) ButtonClicked:(id)sender
{
	 HiAppDelegate *appDelegate = (HiAppDelegate *)[[UIApplication  sharedApplication] delegate];
	[appDelegate OpenForm2];
}
@end

this is how the OpenForm2 look like ()Inside my delegate

Code:
-(void) OpenForm2
{
    [form1.view removeFromSuperview];
    [window addSubView:form2.view];
}
When i call this method from inside the delegate it works fine but when i call it from my form1 the application gets stuck with no exception.

Any idea what the problem is?
Is this a good way of navigation? (I do not want to have any navigation bar)
If not how else can i navigate through my views?

Thanks in advance
aryaxt is offline   Reply With Quote
Old 12-31-2008, 04:58 PM   #2 (permalink)
Registered Member
 
Join Date: Aug 2008
Location: London/Peterborough
Posts: 534
Default Hi

Hi, have you watched this video?

http://www.iphonedevsdk.com/forum/ip...e-xib-how.html
QuantumDoja is offline   Reply With Quote
Old 12-31-2008, 05:27 PM   #3 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: Oceanside, CA
Posts: 570
Default

thx, but I think he's making this too complicated.
There should be an easier way.
I try to figure out a better way, if i don't find another way, i do it his way
aryaxt is offline   Reply With Quote
Old 12-31-2008, 05:41 PM   #4 (permalink)
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,122
Default

I don't think it's easy to replace the main window view. What would probably work much easier is to have some empty UIView as the main view added to the window. Then your two form views become subviews of this empty view instead of the window.

Is that clear? (it is in my head )
RickMaddy is offline   Reply With Quote
Old 12-31-2008, 06:05 PM   #5 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: Oceanside, CA
Posts: 570
Default

Great help, like the rest of your answers.
I'm gonna try it , and post the result asap
aryaxt is offline   Reply With Quote
Old 01-01-2009, 11:42 AM   #6 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: Oceanside, CA
Posts: 570
Default

Happy New Year.
I woke up totally hung over, just to try ur idea.
And i gotta tell you. ur my hero
It worked perfectly.
"Back to bed"
aryaxt is offline   Reply With Quote
Reply

Bookmarks

Tags
app delegate, appdelegate, navigation

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 273
21 members and 252 guests
ADY, AragornSG, Bertrand21, Dani77, Dattee, fkmtc, HDshot, HemiMG, iDifferent, JasonR, jimbo, macquitzon216, mer10, prchn4christ, Rudy, sacha1996, sneaky, spiderguy84, Sunny46, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,767
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:09 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0