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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Tools & Utilities

Reply
 
LinkBack Thread Tools Display Modes
Old 08-04-2011, 12:56 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2011
Location: USA
Posts: 3
ebeth18 is on a distinguished road
Default UIButton setting hidden

I am working on an app for the iPad and I have a UIButton in the detail view.

in DetailViewController.h:
Code:
IBOutlet UIButton *myButton
in DetailViewController.m:
Code:
-(void)setDetailItem:(id)newDetailItem{
  if (detailItem != newDetailItem){
     [detailItem release];
     detailItem = [newDetailItem retain];
  }
  myButton.hidden = NO;
  if (self.popoverController != nil){
     [self.popoverController dismissPopoverAnimated:YES];
  }
}

-(void) viewDidLoad{
myButton.hidden = YES;
[super viewDidLoad]; //also, what does this mean?
}
I am not sure why the button refuses to unhide. I have it set to enabled and hidden in Interface Builder, and am trying to figure out why it's not becoming visible when I change the value of myButton.hidden. Thoughts?

Last edited by ebeth18; 08-04-2011 at 04:28 PM.
ebeth18 is offline   Reply With Quote
Old 08-05-2011, 02:42 AM   #2 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

Double check your button connection.

[super viewDidLoad] will call viewDidLoad on your super class. If you are using the default UIViewController subclass, calling viewDidLoad on super won't really do anything but it's good practice. On stuff like viewDidLoad, call super first.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 08-11-2011, 03:18 AM   #3 (permalink)
Registered Member
 
DeeJay_CRO's Avatar
 
Join Date: Feb 2011
Location: Osijek, Croatia
Posts: 64
DeeJay_CRO is on a distinguished road
Default

Quote:
Originally Posted by ebeth18 View Post
I am working on an app for the iPad and I have a UIButton in the detail view.

in DetailViewController.h:
Code:
IBOutlet UIButton *myButton
in DetailViewController.m:
Code:
-(void)setDetailItem:(id)newDetailItem{
  if (detailItem != newDetailItem){
     [detailItem release];
     detailItem = [newDetailItem retain];
  }
  myButton.hidden = NO;
  if (self.popoverController != nil){
     [self.popoverController dismissPopoverAnimated:YES];
  }
}

-(void) viewDidLoad{
myButton.hidden = YES;
[super viewDidLoad]; //also, what does this mean?
}
I am not sure why the button refuses to unhide. I have it set to enabled and hidden in Interface Builder, and am trying to figure out why it's not becoming visible when I change the value of myButton.hidden. Thoughts?
Why did you set it to hidden in IB? Try not to...
DeeJay_CRO is offline   Reply With Quote
Old 08-11-2011, 10:56 AM   #4 (permalink)
Registered Member
 
Join Date: Aug 2010
Location: Edinburgh
Posts: 209
Justinmichael is on a distinguished road
Default

Must be your IB to code connection that is broken. setting myButton.hidden = NO should work fine. Try adding this line to viewDidLoad:
Quote:
NSLog(@"button %@", myButton);
It probably thinks it is nil.
__________________
Justinmichael is offline   Reply With Quote
Reply

Bookmarks

Tags
uibutton

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: 404
11 members and 393 guests
AppleDev, chemistry, Gi-lo, ipodphone, mistergreen2011, pipposanta, QuantumDoja, Retouchable, RobTaku, SLIC
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,679
Threads: 94,129
Posts: 402,925
Top Poster: BrianSlick (7,990)
Welcome to our newest member, xzoonxoom
Powered by vBadvanced CMPS v3.1.0

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