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

Reply
 
LinkBack Thread Tools Display Modes
Old 09-13-2010, 02:12 PM   #1 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 44
AYamout23 is on a distinguished road
Default How to pass a view controller to an object in an array?

So I have this object in my array: @"Beginner Knowledge"
And then I'm putting it in a cell in a table.

When a user clicks on a cell, I push a view controller.
The view controller's name is the object in the array and appending it by "ViewController".

Apparently because of the space between Beginner and Knowledge, I can't seem to make that work for that object.

Any suggestions?
AYamout23 is offline   Reply With Quote
Old 09-13-2010, 03:16 PM   #2 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 44
AYamout23 is on a distinguished road
Default

Anyone?
AYamout23 is offline   Reply With Quote
Old 09-13-2010, 03:40 PM   #3 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 651
kapps11 is on a distinguished road
Default

I'm confused as to what you mean. You mean that you push a viewcontroller and the nib name is that object plus viewcontroller? If so that is a HORRIBLE way to design your app. A much better way is to design a view controller that has one xib, and then you create a custom init method for it lke [viewcontroller initWithObject:]; and that would also fix your problem. Read the apple docs theyre very helpful and specific on the best way to do this
kapps11 is offline   Reply With Quote
Old 09-13-2010, 04:04 PM   #4 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 44
AYamout23 is on a distinguished road
Default

Quote:
Originally Posted by kapps11 View Post
I'm confused as to what you mean. You mean that you push a viewcontroller and the nib name is that object plus viewcontroller? If so that is a HORRIBLE way to design your app. A much better way is to design a view controller that has one xib, and then you create a custom init method for it lke [viewcontroller initWithObject:]; and that would also fix your problem. Read the apple docs theyre very helpful and specific on the best way to do this

What if each of them has a different kind of view controller?
All the apple docs show you how to do one with similar view controllers, and just the text changes or something.
AYamout23 is offline   Reply With Quote
Old 09-13-2010, 04:08 PM   #5 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 651
kapps11 is on a distinguished road
Default

Thats because thats what makes the most sense its much more efficient and if you display completely dif view controllers for each one then it visually feels different for the user. But if its only that one that messes you up, just do a check and then hard code if you absolutley need to. -

Code:
if ([cell.text isEqualTo:@"This Thing") {
//init new view controller with special name
}
but thats very inefficient code
kapps11 is offline   Reply With Quote
Old 09-13-2010, 04:24 PM   #6 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 44
AYamout23 is on a distinguished road
Default

Quote:
Originally Posted by kapps11 View Post
Thats because thats what makes the most sense its much more efficient and if you display completely dif view controllers for each one then it visually feels different for the user. But if its only that one that messes you up, just do a check and then hard code if you absolutley need to. -

Code:
if ([cell.text isEqualTo:@"This Thing") {
//init new view controller with special name
}
but thats very inefficient code
I guess Imma go with your initial suggestion.
Thanks mate
AYamout23 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: 331
14 members and 317 guests
Absentia, cgokey, fiftysixty, givensur, heshiming, iGamesDev, linkmx, michaelhansen, mraalex, PixelInteractive, raihan.zbr, Sloshmonster, Trickphotostudios
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,117
Posts: 402,890
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

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