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 11-14-2009, 11:59 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 23
Default Calling an IBAction from another file

Hi,

The structure of my app is:

switchviewcontroller who's sole responsibility is to change the views of the page.

mainmenucontroller this contains the code and xib of a main menu view.

What I have is a UIButton in mainmenucontroller, which when pressed loads a mapcontroller view. In switchviewcontroller I have an IBAction to load and unload the views. How can I make it so that the mainmenucontroller can access this IBAction as at the moment it doesn't show. If I try changing it's class to switchviewcontroller, the IBAction shows and I can connect it to the UIButton but it crashes with unrecognized selector sent to instance.

Thanks
Denis
xnapp is offline   Reply With Quote
Old 11-14-2009, 12:17 PM   #2 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 519
Default

I don't understand..why don't you just set up an IBAction in the main menu to do the same thing?
__________________
Water Your Body (ON SALE $0.99)

Top Paid in Health & Fitness!

Tic Tac Pro ($0.99)

New and Noteworthy!

Click here to see a really cool website
bravetarget is offline   Reply With Quote
Old 11-14-2009, 01:34 PM   #3 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 23
Default

Quote:
Originally Posted by bravetarget View Post
I don't understand..why don't you just set up an IBAction in the main menu to do the same thing?
Okay I've done that and it now loads the new page, but leaves some elements on the page (labels, UIImageviews, buttons). How can I get rid of these? I thought doing:

[mainMenuController.view removeFromSuperview]

would clear it but obviously now.
xnapp is offline   Reply With Quote
Old 11-14-2009, 01:37 PM   #4 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 519
Default

Try:

[self.view bringSubViewToFront:mapcontroller.view];
__________________
Water Your Body (ON SALE $0.99)

Top Paid in Health & Fitness!

Tic Tac Pro ($0.99)

New and Noteworthy!

Click here to see a really cool website
bravetarget is offline   Reply With Quote
Old 11-14-2009, 02:10 PM   #5 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 23
Default

That works, but surely that would be inefficient as for each page change it'll just add it on top of the other one? Or this not the case.
xnapp is offline   Reply With Quote
Old 11-15-2009, 01:51 PM   #6 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 23
Default

I think it does just add it on top of the rest of the stuff because when viewing system resources, when I clicked on the UIButton the memory usage went up. Obviously this isn't the best way of doing it as eventually there will be lots of layers on top of each other right? So how can I clear the labels as well.
xnapp is offline   Reply With Quote
Reply

Bookmarks

Tags
ibaction, instance, selector, unrecognized

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
» Stats
Members: 158,884
Threads: 89,229
Posts: 380,763
Top Poster: BrianSlick (7,129)
Welcome to our newest member, karlam963
Powered by vBadvanced CMPS v3.1.0

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