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

View Single Post
Old 10-22-2008, 10:24 AM   #154 (permalink)
EeKay
Registered Member
 
Join Date: Aug 2008
Location: The Netherlands
Age: 31
Posts: 86
EeKay is on a distinguished road
Default

Quote:
Originally Posted by Jolly1 View Post
Hello All, very new to this.



I am using IB. I have done the separate controllers, they're working fine, and I'm intercepting actions from some test buttons I have set up in each of the controllers.

However, I can't seem to figure out how to connect my outlets? In other words, I need to be able to change the text in a label in a particular view, and I can't seem to figure out how to attach that label to any of my classes within IB.

I assume I have to subclass UIView? How does that work with my separate .xib files? I'm a bit confused around the edges here.

Thanks, this thread is great!

Jolly
Jolly. I try to give an example using the viewOne as our subject:

in the ViewOne.XIB set the File's Owner class as ViewOneController (via the last tab in the inspector - Class identity section).

Create IBOutlets(in .h file, along with @property, and in .M file use @synthesize) in the ViewOneController for each IB field,label etc that you need to change/read. In IB you can now connect the label to the File's Owner and select the IBOutlet corresponding to the item you select.

f.i:
//.h file
IBOutlet UILabel *mylabel;
} //end of class definition

@property (nonatomic, retain)IBOutlet UILabel *mylabel;

//.M file
@synthesize myLabel;
//it now has setMyLabel and getMyLabel since its a property.

From code, you can now access the field/label/.. using self.myLabel.text or [self setMyLabel].

i wrote this up in 1 min so try if its syntax correct but i hope you get the idea..
__________________
EeKay Sez:: : :

0110100001100101011011000110110001101111 to you !

WwW : www.eekay.nl
mniE : www.mynameise.com/eekay
Twitter : www.twitter.com/eekayonline
EeKay is offline   Reply With Quote
 

» Advertisements
» Online Users: 439
14 members and 425 guests
antonwilliams, dobry, Domele, EvilElf, Gaz, hrushikeshaddon, iconomania, ipodphone, jaychoupham, linkmx, raymng, santicarlo, Techknol, TunaNugget
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,589
Threads: 94,083
Posts: 402,775
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Techknol
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:53 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.