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 01-06-2010, 04:12 PM   #1 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 11
Question Accessing buttons placed with IB in code?

I'm building an app that using a navController to move through my views. In one area I have two different views that push to the same view. On that last view I would like to hide/show a button based on which view it came from.

Is it possible to change button properties that were created with IB within the code?
pacman6642 is offline   Reply With Quote
Old 01-06-2010, 04:14 PM   #2 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

The answer to your question is yes.

The search term you are looking for is "IBOutlet".
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 01-06-2010, 04:19 PM   #3 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 11
Default

Quote:
Originally Posted by BrianSlick View Post
The answer to your question is yes.

The search term you are looking for is "IBOutlet".
Sweet thanks.
pacman6642 is offline   Reply With Quote
Old 01-06-2010, 05:03 PM   #4 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 11
Default

Ok I linked up the button that needs the hidden value changed up to an IBOutlet and got it to hide based on the view it comes form.

On a side note I had described what I was doing wrong. The app only moves form one view to the next. The button needed to be hidden based on which button on the current view was pressed. Originally I was set up a bool in view1 and then instantiated an object of view1controller in view2 controller and then compared it to TRUE/FALSE to see if the button needed to be hidden.

Either it was always evaluating to true or this was causing the value of the buttons property to be changed after the view was drawn. Instead I just created another function exactly like the one for the other button and set the hidden property of the button on the next view to TRUE/FALSE respectively before I push the view.

Basically it seems to me you need to do any set up any of your IBOjects before you draw the view. Is there a way to cause the current view to update itself?
pacman6642 is offline   Reply With Quote
Old 01-07-2010, 01:02 PM   #5 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

You probably need to move your code from viewDidLoad to viewWillAppear, but it's tough to say without knowing what you're doing.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Reply

Bookmarks

Tags
code, interface builder, iphone sdk

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,885
Threads: 89,230
Posts: 380,765
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 02:24 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0