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 10-20-2009, 12:12 AM   #1 (permalink)
Registered Member
 
LiquidChaz's Avatar
 
Join Date: Sep 2009
Location: New York City
Posts: 53
Default Synthesizing an array of UIImageView objects?

I'm trying to declare an array of UIImageView objects but I keep getting the error type of property 'mySquare' does not match type of ivar 'mySquare' on the synthesize line. What am I doing wrong?


In the .h:

UIImageView *mySquare[3];

@property (nonatomic, retain) UIImageView *mySquare;

And in the .m:

@synthesize mySquare; //error is here
LiquidChaz is offline   Reply With Quote
Old 10-20-2009, 08:41 AM   #2 (permalink)
Registered Member
 
rwenderlich's Avatar
 
Join Date: Aug 2009
Posts: 162
Default

The problem is c-style arrays and properties don't get along too well... there's a nice article describing the problem here:

@synthesize-ing a C array of structs in Objective-C 2.0 - Stack Overflow

If you want to keep using c-style arrays as you have it, you could use the following work-around:

Code:
// .h
@property (readonly) UIImageView ** mySquare;
// .m
@dynamic mySquare;
- (UIImageView **)mySquare { return mySquare; }
Another perhaps simpler workaround is to use an NSArray instead of a c-style array.
__________________
Check out my iPhone development blog!

Motivate yourself to become an expert with LevelMeUp!

--Ray Wenderlich
rwenderlich is offline   Reply With Quote
Reply

Bookmarks

Tags
array, nsarray, objects, synthesize, uiimageview

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: 259
24 members and 235 guests
ADY, AragornSG, bookesp, chillyh, dacapo, Dani77, Davey555, Desert Diva, Dominus, glenn_sayers, HemiMG, JasonR, LEARN2MAKE, M.A.S., marshusensei, mer10, nobre84, Oral B, prchn4christ, Raggou, Rudy, themathminister, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» 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:31 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0