 |
 |
|
 |
03-08-2009, 12:10 AM
|
#1 (permalink)
|
|
New Member
Join Date: Mar 2009
Posts: 16
|
A noob and his nib, hooking a UIImageView
hello,
I am learning iPhone dev and I love it so far. I am having an issue where I created a UITabBarController that loads 4 views. All of this was done in the nibs (except for actually creating the UITabBarController in the delegate class). Everything works perfectly. What I want to do is hook an UIImageView in the xib so I can change it in code from the viewcontroller. So I created an IBOutlet in my firstViewController and dragged a UIImageView onto my view. But anytime I hook the outlet up, the application just bombs. I even tried dragging a UIImageView into the firstView.xib and didnt put it on the view, that runs fine, but when I hook up the outlet it just bombs on me with an uncaught exception.
Maybe I am approaching this the wrong way. Ultimately I want a view with a few images that the user can swipe to view. Am I going about this the wrong way?
Thanks and sorry if this is really basic stuff... I am a c# developer but I'm tryin real hard to convert.
Here is my code:
@interface HomeViewController : UIViewController {
IBOutlet UIImageView *homeImageView;
}
@property(nonatomic,retain) UIImageView *homeImageView;
@end
@implementation HomeViewController
@synthesize homeImageView;
Then I just ctrl+drag from File Owner to the ImageView in IB and save. Then BOOM!
-Savij
Last edited by Savij; 03-08-2009 at 12:47 AM.
Reason: added code
|
|
|
03-08-2009, 05:34 AM
|
#2 (permalink)
|
|
Registered Member
Join Date: Jan 2009
Location: Florida
Age: 22
Posts: 31
|
f.
Last edited by ArgMan; 07-09-2009 at 08:12 PM.
|
|
|
03-08-2009, 06:21 PM
|
#3 (permalink)
|
|
New Member
Join Date: Mar 2009
Posts: 16
|
Quote:
Originally Posted by ArgMan
I don't know enough to give you an answer, but may I just say: +1 for the thread title. Very nice.
|
<grin> thanks.
Can anyone point me in the right direction??
Thanks,
-Savij
|
|
|
03-08-2009, 10:13 PM
|
#4 (permalink)
|
|
New Member
Join Date: Sep 2008
Posts: 1,431
|
What is the exception that appears in the console?
Use the code tags for showing code.
Put the IBOutlet token on your property, not (only) on your ivar.
Last edited by PhoneyDeveloper; 04-02-2009 at 10:05 PM.
|
|
|
03-08-2009, 10:30 PM
|
#5 (permalink)
|
|
New Member
Join Date: Dec 2008
Location: Miami, FL
Posts: 36
|
In IB, check class identity, make sure you have the correct view controller.
|
|
|
03-09-2009, 08:26 PM
|
#6 (permalink)
|
|
New Member
Join Date: Mar 2009
Posts: 16
|
Quote:
Originally Posted by xlphs
In IB, check class identity, make sure you have the correct view controller.
|
Thanks for the tips, I know the class identity is correct, but I did forget the IBOutlet on the property. I'll give that a try.
Thanks!!
-S
|
|
|
04-02-2009, 08:46 PM
|
#7 (permalink)
|
|
New Member
Join Date: Mar 2009
Posts: 16
|
Just realized I never closed out this thread. The problem I had, I could not figure out. I copied the code to a new project and it worked! I must have changed some setting in xcode inadvertantly, or maybe the project got corrupt somehow.
Anyway the above worked great! Thanks for the help
-J
|
|
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Advertisements |
» Online Users: 434 |
| 40 members and 394 guests |
| AdamSubach, aderrington, anubhab123, benoitr007, BrianSlick, caseysackett, Chessin, Danneman, dev123, ErichGS, futurevilla216, Gambit, GreatWizard, gw1921, HemiMG, HowEver, iSDK, Jeremy1026, joelhull, lifeCoder45, mattiahalter, mcapraro, melodizzzy, mriphoneman, newchucky, Ovidius, Piequanna, qilin, Racker, rendezvouscp, riq, Sega dude, socals, themathminister, timle8n1, tinrocket, Whitehk, ZunePod |
| Most users ever online was 965, 06-30-2010 at 04:26 AM. |
» Stats |
Members: 41,862
Threads: 49,771
Posts: 213,058
Top Poster: BrianSlick (3,139)
|
| Welcome to our newest member, futurevilla216 |
|