PDA

View Full Version : [Resolved] Help please, trying to get this view to work




troop231
Mar 30, 2011, 11:23 AM
Hi, I have a simple questions view I need to load when a user taps on the selected row in the previous root view, but my view that gets loaded is just blank:
http://img821.imageshack.us/img821/3272/79372873.png

When it should look like this with the nav bar at the top:

http://img156.imageshack.us/img156/9844/screenshot20110330at905.png

Here is my code: Questions.h:

#import <UIKit/UIKit.h>

@interface Questions : UIViewController
{ UIView *View;

int currentQuestionIndex;

// The model objects
NSMutableArray *questions;


//The view objects
IBOutlet UILabel *questionField;



}

@property (nonatomic, retain) UIView *view;

- (IBAction)showQuestion:(id)sender;


@end

and Questions.m:

#import "Questions.h"


@implementation Questions

@synthesize view;

- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation !=
UIInterfaceOrientationPortraitUpsideDown);
}

- (void)viewDidLoad {

[super viewDidLoad];
self.title = @"Test"; }

-(id)init
{
// Call the init method implemented by the superclass
[super init];

// Create two arrays and make the pointers point to them
questions = [[NSMutableArray alloc] init];


// Add questions and answers to the arrays
[questions addObject:@"Where do you think our country lacks?"];


[questions addObject:@"Who do you feel is the most popular person in the world? Why?"];


[questions addObject:@"Should the government bail out failing companies?"];





// Return the address of the new object
return self;

}

- (IBAction)showQuestion:(id)sender
{
// Step to the next question - just to keep things simple
// to focus on the iOS elements of the programming,
// we will start with the "second" question in the list.
currentQuestionIndex++;

// Am I past the last question?
if (currentQuestionIndex == [questions count]) {
// Go back to the first question
currentQuestionIndex = 0;
}

// Get the string at that index in the questions array
NSString *question = [questions objectAtIndex:currentQuestionIndex];

// Log the string to the console
NSLog(@"displaying question: %@", question);

//Display the string in the question field
[questionField setText:question];



}



- (void)dealloc {
[view release];
[super dealloc];
}


@end I know the answer will seem very easy to someone here, so any help is appreciated! I need to get this working by Friday :(



ritsard
Mar 30, 2011, 01:21 PM
How are you loading the Questions view in your app? Is it declared and used in the App delegate?

troop231
Mar 30, 2011, 01:34 PM
How are you loading the Questions view in your app? Is it declared and used in the App delegate?

In my root view controller:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

//Get the dictionary of the selected data source.
NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row];

//Get the children of the present item.
NSArray *Children = [dictionary objectForKey:@"Children"];

if([Children count] == 0) {
NSInteger ViewNumber = [[dictionary objectForKey:@"View"] integerValue];
switch (ViewNumber) {
case 1: {
RootViewController *rvc = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]];
//Switch the view here
rvc.view = tbController.view;
[self.navigationController pushViewController:rvc animated:YES];
[rvc release];
}
break;
case 2: {
Questions *ivc2 = [[Questions alloc] initWithNibName:@"Questions" bundle:[NSBundle mainBundle]];

[self.navigationController pushViewController:ivc2 animated:YES];
[ivc2 release];
}
break;

chown33
Mar 30, 2011, 01:58 PM
Post any warnings or errors that appeared during compilation.
Don't paraphrase them, copy and paste them exactly.


@interface Questions : UIViewController
{ UIView *View;
...
@property (nonatomic, retain) UIView *view;
The red-hilited code looks wrong to me.

The instance variable's name is View (capital V), but your property name is view (small v). Objective-C is case-sensitive, so View and view are different things.

Furthermore, UIViewController already has a view property. It seems like a bad idea to me to override it with your own synthesized property of the same name. It seems like an equally bad idea to have a second property or ivar named View, which seems to have the same purpose as the existing view property.

troop231
Mar 30, 2011, 02:07 PM
Post any warnings or errors that appeared during compilation.
Don't paraphrase them, copy and paste them exactly.


@interface Questions : UIViewController
{ UIView *View;
...
@property (nonatomic, retain) UIView *view;
The red-hilited code looks wrong to me.

The instance variable's name is View (capital V), but your property name is view (small v). Objective-C is case-sensitive, so View and view are different things.

Furthermore, UIViewController already has a view property. It seems like a bad idea to me to override it with your own synthesized property of the same name. It seems like an equally bad idea to have a second property or ivar named View, which seems to have the same purpose as the existing view property.

There isn't any compilation errors, the app runs fine, but as I showed above with the white pic that is all that gets loaded, when the blue should be shown instead, and I did fix the capital 'V' in view so disregard that.

dejo
Mar 30, 2011, 02:23 PM
Why do you think you need to override UIViewController's view property?

troop231
Mar 30, 2011, 02:27 PM
Why do you think you need to override UIViewController's view property?

I didn't think lol I just don't know what to do at all! So what should I do to get this thing to work?

EDIT:

I deleted the reference to UIView *view guys and I ALMOST have this solved!

Now when I push on the "Next Question" button the app crashes! Possibly wrong connections/issues in IB?

here is a screenshot and the console output:

http://i51.tinypic.com/2573bbd.png


[Session started at 2011-03-30 15:53:39 -0400.]
2011-03-30 15:53:46.893 PageantPlanet[17248:207] -[__NSCFType showQuestion:]: unrecognized selector sent to instance 0x4c4ca80
2011-03-30 15:53:46.895 PageantPlanet[17248:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType showQuestion:]: unrecognized selector sent to instance 0x4c4ca80'
*** Call stack at first throw:
(
0 CoreFoundation 0x00e24be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f795c2 objc_exception_throw + 47
2 CoreFoundation 0x00e266fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x00d96366 ___forwarding___ + 966
4 CoreFoundation 0x00d95f22 _CF_forwarding_prep_0 + 50
5 UIKit 0x0032da6e -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x003bc1b5 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x003be647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x003bd1f4 -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x003520d1 -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x0033337a -[UIApplication sendEvent:] + 447
11 UIKit 0x00338732 _UIApplicationHandleEvent + 7576
12 GraphicsServices 0x0175aa36 PurpleEventCallback + 1550
13 CoreFoundation 0x00e06064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x00d666f7 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x00d63983 __CFRunLoopRun + 979
16 CoreFoundation 0x00d63240 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x00d63161 CFRunLoopRunInMode + 97
18 GraphicsServices 0x01759268 GSEventRunModal + 217
19 GraphicsServices 0x0175932d GSEventRun + 115
20 UIKit 0x0033c42e UIApplicationMain + 1160
21 PageantPlanet 0x000029c4 main + 102
22 PageantPlanet 0x00002955 start + 53
)
terminate called after throwing an instance of 'NSException'

TheWatchfulOne
Mar 30, 2011, 03:33 PM
Not sure if it's related to your crash, but here's something I noticed:

In the init method in your Questions implementation file, you declared an array but you never added a nil value as the last component of the array. I was under the impression an NSArray(or NSMutableArray which is a sub class of NSArray) needs to have a nil as its last component.

Also, is there a reason you are using an NSMutableArray vs. just NSArray? If you are providing preloaded questions and not allowing the user to add their own questions, then you might ought to use just NSArray. All the books I've been going through use the arrayWithValues (if I remember correctly) method to add values to the array with a nil value being the last. This is done so that when you iterate through the values in the array and you reach nil, then you know you've reached the end of the array.

chown33
Mar 30, 2011, 03:35 PM
Post your revised code.


This error message:
2011-03-30 15:53:46.893 PageantPlanet[17248:207] -[__NSCFType showQuestion:]: unrecognized selector sent to instance 0x4c4ca80

strongly suggests a message is being sent to an object that isn't of the class it needs to be. The message being sent is showQuestion:. That should ring a bell, and tell you something about which object is the wrong type. It should also suggest something about which connection or which instance in the nib is incorrect.

I get the impression you're rushing through this without a clear software design. Consequently, you're making mistakes that would be avoidable with a clear design or even a simple roadmap. That means you have to go back and fix dumb mistakes that could be avoided with just a little planning and forethought, which takes longer overall than if you'd simply put in the planning in the first place. Haste makes waste.



Not sure if it's related to your crash, but here's something I noticed:

In the init method in your Questions implementation file, you declared an array but you never added a nil value as the last component of the array. I was under the impression an NSArray(or NSMutableArray which is a sub class of NSArray) needs to have a nil as its last component.

This impression is incorrect.

The nil terminator is used only with certain methods, which initialize the array from a variable number of objects. When using those methods, the nil terminator is not added to the array.

No nil is needed in the OP's code because it isn't using the initializer which takes a variable number of objects

troop231
Mar 30, 2011, 08:16 PM
Post your revised code.


This error message:
2011-03-30 15:53:46.893 PageantPlanet[17248:207] -[__NSCFType showQuestion:]: unrecognized selector sent to instance 0x4c4ca80

strongly suggests a message is being sent to an object that isn't of the class it needs to be. The message being sent is showQuestion:. That should ring a bell, and tell you something about which object is the wrong type. It should also suggest something about which connection or which instance in the nib is incorrect.

I get the impression you're rushing through this without a clear software design. Consequently, you're making mistakes that would be avoidable with a clear design or even a simple roadmap. That means you have to go back and fix dumb mistakes that could be avoided with just a little planning and forethought, which takes longer overall than if you'd simply put in the planning in the first place. Haste makes waste.




This impression is incorrect.

The nil terminator is used only with certain methods, which initialize the array from a variable number of objects. When using those methods, the nil terminator is not added to the array.

No nil is needed in the OP's code because it isn't using the initializer which takes a variable number of objects

Here is revised code: Questions.h:

#import <UIKit/UIKit.h>

@interface Questions : UIViewController
{

int currentQuestionIndex;

// The model objects
NSMutableArray *questions;


//The view objects
IBOutlet UILabel *questionField;



}

@property (nonatomic, retain) UIView *view;

- (IBAction)showQuestion:(id)sender;


@end

and Questions.m:

#import "Questions.h"


@implementation Questions



- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation !=
UIInterfaceOrientationPortraitUpsideDown);
}

- (void)viewDidLoad {

[super viewDidLoad];
self.title = @"Interview Questions"; }

-(id)init
{
// Call the init method implemented by the superclass
[super init];

// Create two arrays and make the pointers point to them
questions = [[NSMutableArray alloc] init];


// Add questions and answers to the arrays
[questions addObject:@"Where do you think our country lacks?"];


[questions addObject:@"Who do you feel is the most popular person in the world? Why?"];


[questions addObject:@"Should the government bail out failing companies?"];


// Return the address of the new object
return self;

}

- (IBAction)showQuestion:(id)sender
{
// Step to the next question - just to keep things simple
// to focus on the iOS elements of the programming,
// we will start with the "second" question in the list.
currentQuestionIndex++;

// Am I past the last question?
if (currentQuestionIndex == [questions count]) {
// Go back to the first question
currentQuestionIndex = 0;
}

// Get the string at that index in the questions array
NSString *question = [questions objectAtIndex:currentQuestionIndex];

// Log the string to the console
NSLog(@"displaying question: %@", question);

//Display the string in the question field
[questionField setText:question];



}



- (void)dealloc {

[super dealloc];
}


@end Here are the screenshots of the IB connections:

Overview: http://img822.imageshack.us/img822/4277/screenshot20110330at933.png

Button: http://img194.imageshack.us/img194/9904/buttonim.png
Files Owner: http://img28.imageshack.us/img28/9568/filesowner.png
Label: http://img52.imageshack.us/img52/9135/labelu.png
Questions: http://img593.imageshack.us/img593/9736/questionsx.png
View: http://img855.imageshack.us/img855/6717/viewl.png

jnoxx
Mar 31, 2011, 03:34 AM
Another thing is, u could also do bundle:nil when ur pushing ur view.
U also can remove the property of the UIView, since it's a lose reference.
Might be that's that the problem to for the crash.
Be carefull with overriding the standard stuff :)
Good luck

troop231
Mar 31, 2011, 08:34 AM
Another thing is, u could also do bundle:nil when ur pushing ur view.
U also can remove the property of the UIView, since it's a lose reference.
Might be that's that the problem to for the crash.
Be carefull with overriding the standard stuff :)
Good luck

It's not crashing anymore when the view is loaded, only when I push on the button: "Next Question"

jnoxx
Mar 31, 2011, 08:42 AM
Do what i said anyways, and try commenting out allt he lines inside your method, see what that does. then line per line add back in, see where it crashes, or just use the debugger.

dejo
Mar 31, 2011, 12:18 PM
Are you sure your Question's init method is being called? Because you are using initWithNibName:bundle: in your rootViewController:
Questions *ivc2 = [[Questions alloc] initWithNibName:@"Questions" bundle:[NSBundle mainBundle]];

troop231
Mar 31, 2011, 01:06 PM
Are you sure your Question's init method is being called? Because you are using initWithNibName:bundle: in your rootViewController:

Yeah, pretty sure, so far today I've made it to where it doesn't crash when you push "Next Question" However the UILabel is blank when I push it, so I'm not sure where my connections are wrong? Screenshots:

Xib File Owner Connections:

http://img836.imageshack.us/img836/1741/screenshot20110331at203.png


Questions Xib loaded: http://img707.imageshack.us/img707/1222/64485564.png


When Next Question button is pushed Label is blank: http://img192.imageshack.us/img192/5882/15273403.png

dejo
Mar 31, 2011, 01:14 PM
Yeah, pretty sure, so far today I've made it to where it doesn't crash when you push "Next Question"
Pretty sure? I would make absolutely sure. Put a breakpoint in your init, say where you add your first object to questions. When you run the code, does it stop at the breakpoint? Just so you know, I've tried to reproduce your project and my breakpoint doesn't get reached.

troop231
Mar 31, 2011, 01:37 PM
Pretty sure? I would make absolutely sure. Put a breakpoint in your init, say where you add your first object to questions. When you run the code, does it stop at the breakpoint? Just so you know, I've tried to reproduce your project and my breakpoint doesn't get reached.

I know it's working, the Questions.xib is being loaded when case 2 is being called from my plist. I did the same thing with my outdoor app.

I just still don't know where the connections are wrong.

Edit: I don't know how to do a breakpoint anyways.

dejo
Mar 31, 2011, 02:02 PM
I know it's working, the Questions.xib is being loaded when case 2 is being called from my plist. I did the same thing with my outdoor app.

I just still don't know where the connections are wrong.
Well, it's not really working, is it? Sure, your view is being presented but your questions array is not being loaded with objects.

Edit: I don't know how to do a breakpoint anyways.
Well, then, now would be a good opportunity to learn how, wouldn't you say? I'd suggest checking the Xcode User Guide for more information.

troop231
Mar 31, 2011, 07:03 PM
Well, it's not really working, is it? Sure, your view is being presented but your questions array is not being loaded with objects.


Well, then, now would be a good opportunity to learn how, wouldn't you say? I'd suggest checking the Xcode User Guide for more information.

I'm even more lost now, I searched within the iOS dev library on Apple's site and it just confused me even more, I just want to know why this isn't working when It worked fine as a stand alone app that was in my Apress book.

chown33
Mar 31, 2011, 07:30 PM
What else could you do that would confirm that a certain point in the code is being reached? Maybe some kind of log that you could write messages to, like "In init method of BarkingMad class".

And at this point, most of Apple's site has probably been changed to Xcode 4 docs, so searching there is unlikely to help if you're using Xcode 3. Maybe there's some kind of builtin help in Xcode, perhaps even a menu named Help or something where you can type in the search term "breakpoint" or "debugger".

I just want to know why this isn't working when It worked fine as a stand alone app that was in my Apress book.
It doesn't work because something is different. Exactly what, only you can determine, because you're currently the only one with all the parts of the project. If only there were some way for others to get access to all the project parts, they might be able to figure it out.

If you didn't start with a known-working project, then you may not have done everything needed to make things work. You could start over with a known-working project, then modify it gradually, making sure it still works after every change, no matter how small. Honestly, that might be the simplest and quickest route, given that your other alternative is starting from scratch on learning how to use the debugger, then becoming proficient enough to actually use the debugger to find the problem.

troop231
Mar 31, 2011, 07:43 PM
What else could you do that would confirm that a certain point in the code is being reached? Maybe some kind of log that you could write messages to, like "In init method of BarkingMad class".

And at this point, most of Apple's site has probably been changed to Xcode 4 docs, so searching there is unlikely to help if you're using Xcode 3. Maybe there's some kind of builtin help in Xcode, perhaps even a menu named Help or something where you can type in the search term "breakpoint" or "debugger".


It doesn't work because something is different. Exactly what, only you can determine, because you're currently the only one with all the parts of the project. If only there were some way for others to get access to all the project parts, they might be able to figure it out.

If you didn't start with a known-working project, then you may not have done everything needed to make things work. You could start over with a known-working project, then modify it gradually, making sure it still works after every change, no matter how small. Honestly, that might be the simplest and quickest route, given that your other alternative is starting from scratch on learning how to use the debugger, then becoming proficient enough to actually use the debugger to find the problem.

Very true, I tried Xcode 4 and hated it because none of the books talk about how to use it yet. Also the app works perfectly as a stand alone app from the book, so I copied the source into a new source file subtracting the app delegate bits since I want this to be an addition to my app and everything is sour, although I feel like I'm one step away because It's not crashing at all, it's just when the Next Question button is pressed, nothing is displayed in the label is my only issue right now :(

EDIT: Here is a link to the working stand alone app project from my book (19KB zip) http://www.2shared.com/file/cTATQbzA/Quiz.html

dejo
Apr 1, 2011, 10:14 AM
...I feel like I'm one step away because It's not crashing at all, it's just when the Next Question button is pressed, nothing is displayed in the label is my only issue right now :(
I believe you're close too. Have you done any further debugging? You don't necessarily need to put in breakpoints; you could just add some NSLog() statements (as chown33 alluded to) to help verify that what you expect to happen is actually happening. I just thought that now would be a good opportunity to become comfortable with some of the Xcode debugging tools at your disposal.

troop231
Apr 1, 2011, 12:00 PM
I believe you're close too. Have you done any further debugging? You don't necessarily need to put in breakpoints; you could just add some NSLog() statements (as chown33 alluded to) to help verify that what you expect to happen is actually happening. I just thought that now would be a good opportunity to become comfortable with some of the Xcode debugging tools at your disposal.

Mr. dejo, did you see the included zip file I linked above? Also, no I haven't tried any other debugging because really I don't know what to debug if it works. NSLog() confuses me too.

dejo
Apr 1, 2011, 12:21 PM
Mr. dejo, did you see the included zip file I linked above?
Yes, I did. I downloaded it and tried it; it works fine! It's setup a little strange in that there is no viewController in the app; most of the work is done in the app delegate. But when I ran it, I had non-null text showing up in the label when pressing the Next Question button. So, I'm not sure what changes you have made between this working app and your not-working one. Would you be willing to attach a zip of your project?

Also, no I haven't tried any other debugging because really I don't know what to debug if it works.
I'm confused. Are you still claiming your app works? Since your label is showing blanks that, to me, means isn't not working. Unless you meant something else.

NSLog() confuses me too.
NSLog() is pretty simple, especially if you use it to just print a simple string to your debugger console (for example, NSLog(@"Hello World"); ). If you can't tackle that, I'm not sure what I can tell you.

troop231
Apr 1, 2011, 12:30 PM
Yes, I did. I downloaded it and tried it; it works fine! It's setup a little strange in that there is no viewController in the app; most of the work is done in the app delegate. But when I ran it, I had non-null text showing up in the label when pressing the Next Question button. So, I'm not sure what changes you have made between this working app and your not-working one. Would you be willing to attach a zip of your project?


I'm confused. Are you still claiming your app works? Since your label is showing blanks that, to me, means isn't not working. Unless you meant something else.


NSLog() is pretty simple, especially if you use it to just print a simple string to your debugger console (for example, NSLog(@"Hello World"); ). If you can't tackle that, I'm not sure what I can tell you.

Great dejo, I really didn't change much at all, since that was a standalone app I needed to port over the code and make it a non delegate source file (if that makes any sense) while leaving the bulk of the code intact.

I can include a zip of my actual project, I will PM you the link.

dejo
Apr 1, 2011, 12:33 PM
I can include a zip of my actual project, I will PM you the link.

I may not get a chance to look at the code until tomorrow but I'll leave you with what I suspect your issue is: you think your init is getting called (and thus your questions array is populated), but it's not.

troop231
Apr 1, 2011, 12:41 PM
I may not get a chance to look at the code until tomorrow but I'll leave you with what I suspect your issue is: you think your init is getting called (and thus your questions array is populated), but it's not.

That's ok, I don't know why the array wouldn't be populated if in the zip file app you tried does it the same way as my code. The only thing I omitted in my source from the book example is having this @interface QuizAppDelegate : NSObject <UIApplicationDelegate>

Where mine is: @interface Questions : UIViewController

Is that the problem? IE meaning excluding NSObject?

troop231
Apr 4, 2011, 02:43 PM
Hey guys, I just solved the code! What I did was this, I had to put the (id) within the viewDidLoad method! :cool:

#import "Questions.h"


@implementation Questions

@dynamic view;

- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation !=
UIInterfaceOrientationPortraitUpsideDown);
}

- (void)viewDidLoad {

[super viewDidLoad];
self.title = @"Interview Questions";



// Call the init method implemented by the superclass


// Create questions array and make the pointers point to it
questions = [[NSMutableArray alloc] init];


// Add questions to the array
[questions addObject:@"Where do you think our country lacks?"];


[questions addObject:@"Who do you feel is the most popular person in the world? Why?"];


[questions addObject:@"Should the government bail out failing companies?"];


[questions addObject:@"Do you think someone's age should be a determining factor whether they are hired for a job or not?"];



// Return the address of the new object
return;

}

- (IBAction)showQuestion:(id)sender
{
// Step to the next question - just to keep things simple
// to focus on the iOS elements of the programming,
// we will start with the "second" question in the list.
currentQuestionIndex++;

// Am I past the last question?
if (currentQuestionIndex == [questions count]) {
// Go back to the first question
currentQuestionIndex = 0;
}

// Get the string at that index in the questions array
NSString *question = [questions objectAtIndex:currentQuestionIndex];

// Log the string to the console
NSLog(@"displaying question: %@", question);

//Display the string in the question field
[questionField setText:question];



}



- (void)dealloc {

[super dealloc];
}


@end

dejo
Apr 4, 2011, 03:14 PM
So, you moved the array population into the viewDidLoad. Good idea. Don't forget to be a good memory-citizen and release your array (often done in the dealloc, but would probably make more sense in the viewDidUnload, since that viewDidLoad's "opposite" method). Also, you should probably clean up some of the unnecessary comments and the return, so they don't cause confusion later.

troop231
Apr 4, 2011, 03:23 PM
So, you moved the array population into the viewDidLoad. Good idea. Don't forget to be a good memory-citizen and release your array (often done in the dealloc, but would probably make more sense in the viewDidUnload, since that viewDidLoad's "opposite" method). Also, you should probably clean up some of the unnecessary comments and the return, so they don't cause confusion later.

Will do!

Now how would I go about loading the 1st question into the UILabel upon initializing? Instead of having to have a placeholder text in the label saying "Push next question" I want it to have the first question if that makes any sense?

dejo
Apr 4, 2011, 04:11 PM
Now how would I go about loading the 1st question into the UILabel upon initializing? Instead of having to have a placeholder text in the label saying "Push next question" I want it to have the first question if that makes any sense?
Look at the code you already added. Do you already have a method that does pretty much what you're asking for here?

troop231
Apr 4, 2011, 04:20 PM
Look at the code you already added. Do you already have a method that does pretty much what you're asking for here?

I feel really stupid... Instead all I did was change the placeholder text to a different question, creating the illusion.

dejo
Apr 4, 2011, 04:23 PM
I feel really stupid... Instead all I did was change the placeholder text to a different question, creating the illusion.
Sounds like more of a band-aid than a solution. What happens if the text of that question changes? Now you'll need to change it in two places. I would suggest seeking a better solution that actually takes advantage of some of the customized code you've already written.