#import "InstatwitViewController.h"
@implementation InstatwitViewController
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *) pickerView {
return 2;
}
- (NSInteger)pickerView:(UIPickerView *) pickerViewnumberOfRowsInComponent :(NSInteger)component {
if (component == 0)
return [activities count];
else
return [feelings count];
}
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
activities = [[NSArray alloc] initWithObjects:@”sleeping”, @”eating”, @”working”, @”thinking”, @”crying”,
@”begging”, @”leaving”, @”shopping”, @”hello worlding”, nil];
feelings = [[NSArray alloc] initWithObjects:@”awesome”, @”sad”, @”happy”, @”ambivalent”,
@”nauseous”, @”psyched”, @”confused”, @”hopeful”, @”anxious”, nil];
}
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfa开发者_开发技巧ceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
switch (component) {
case 0:
return [activities objectAtIndex:row];
case 1:
return [feelings objectAtIndex:row];
}
return nil;
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[activities release];
[feelings release];
[super dealloc];
}
@end
I get the following erros
Stray '\235' in Program - and 100 more with different numbers Missing sentinel function call Incomplete implementation of class InstatwitViewController
Any help, just doing a tutorial from a book, copied exactly, and don't see whats wrong
Your code contains smart quotes. They need to be straight quotes.
Lines like this:
activities = [[NSArray alloc] initWithObjects:@”sleeping”, @”eating”, @”working”, @”thinking”, @”crying”,
@”begging”, @”leaving”, @”shopping”, @”hello worlding”, nil];
Need to be:
activities = [[NSArray alloc] initWithObjects:@"sleeping", @"eating", @"working", @"thinking", @"crying",
@"begging", @"leaving", @"shopping", @"hello worlding", nil];
the error probably is caused by copied exactly
. It means you have at least one character in your code that the compiler cannot parse.
精彩评论