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 > Mac OS X Development Forums > Objective-C, Python, Ruby Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-03-2009, 01:20 AM   #1 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 2
KhoaHoang is on a distinguished road
Default Do not need to initiate an object? (basic issue)

I'm doing assignment 3 that required me draw polygon shapes on a UIView.

I have PolygonShape class which describe NumberOfSides, Min-Max Sides of Polygons.

I have PolygonView.h class inherit from UIVIew:
@interface PolygonView : UIView {
IBOutlet PolygonShape *pogshape;
IBOutlet UILabel *shapelabel;
}

And Controller.m which define :

- (void) awakeFromNib{
NSLog(@"call this first");
[pogshape initWithNumberOfSides: 3 : 12 : 5];
}

Controller.h which define :

@interface Controller : NSObject{
IBOutlet PolygonShape *pogshape;
IBOutlet UILabel *nameLabel;
IBOutlet PolygonView *polyview;
}

I do not find out any "init" which allow us initiate an object. But everything go well, polygon shapes were drawed on UIView, they are changed when i indrease- decrease their numberOfSides.

I wrote :
- (void) awakeFromNib{
NSLog(@"call this first");
pogshape = [[PolygonShape alloc] init];
[pogshape initWithNumberOfSides: 3 : 12 : 5];
}

It seem to be they inititate two objects with the same name "pogshape" and there are nothing happen. Just one shape was drawed.

The question is that an object can be initiated without using "init"?
(Or explain that code)
KhoaHoang is offline   Reply With Quote
Old 10-03-2009, 01:38 AM   #2 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 2
KhoaHoang is on a distinguished road
Default

Oh, may be i found out the answer...
I created an PolygonShape object in MainWindow.xib and i connected "pogshape" variable which is defined in Controller to that object. That mean, pogshape is initiated automatically when i start program.
That right ?
KhoaHoang is offline   Reply With Quote
Reply

Bookmarks

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: 462
13 members and 449 guests
Domele, Duncan C, Feldspar, MacBook MH, Objective Zero, patapple, peterwilli, pipposanta, PixelInteractive, Punkjumper, SLIC, taylor202, Today's Posts
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,694
Threads: 94,137
Posts: 402,950
Top Poster: BrianSlick (7,990)
Welcome to our newest member, peterwilli
Powered by vBadvanced CMPS v3.1.0

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