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 Development > iPhone SDK Development - Advanced Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old 04-29-2011, 02:31 PM   #1 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 324
mariano_donati is on a distinguished road
Default Creating an object from a string

Is there a way to accomplish this? I looked through reflection in objective-c, but I haven't found any such method. I'm wondering if this is even possible.
mariano_donati is offline   Reply With Quote
Old 04-29-2011, 03:49 PM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

you mean something like

Code:
Class MyClass = NSClassFromString(@"ClassName");
id tmp = [[MyClass alloc] init];
SEL selector = NSSelectorFromString(@"yourMethod");
[tmp performSelector:selector withObject:nil];
__________________
dany_dev is offline   Reply With Quote
Old 04-29-2011, 08:22 PM   #3 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 324
mariano_donati is on a distinguished road
Default

Exactly! Thanks.
mariano_donati 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: 368
18 members and 350 guests
AyClass, baja_yu, checkright, dre, epaga, fvisticot, givensur, jPuzzle, Meoz, momolgtm, Newbie123, Objective Zero, Punkjumper, revg, sacha1996, skrew88, tomtom100
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,642
Threads: 94,110
Posts: 402,858
Top Poster: BrianSlick (7,990)
Welcome to our newest member, pinacate
Powered by vBadvanced CMPS v3.1.0

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