Hi Everyone,
I was wondering if somebody out there would be as kind to help me out with an annoying little problem. I have looked around for a solution but I have had no luck.
What im trying to do is make a new entry to an NSMutable array from another view controller.
My array is as follows:
BookmarksViewController.h
#import <UIKit/UIKit.h>
@interface BookmarksViewController : UITableViewController {
NSMutableArray *bookmarksArray;
}
@property (nonatomic, retain) NSMutableArray *bookmarksArray;
@end
BookmarksViewController.m
@synthesize bookmarksArray;
- (void)viewDidLoad {
bookmarksArray = [[NSMutableArray alloc] initWithObjects:@"iPhone",@"iPod",@"MacBook",@"Mac Book Pro",nil];
[super viewDidLoad];
}
- (void)dealloc {
[bookmarksArray release];
[super dealloc];
}
Now I try to add an entry to my array from another view controller:
Ch01GettingStarted.m
#import "Ch01GettingStarted.h"
#import "BookmarksViewController.h"
@implementation Ch01GettingStarted
-(IBAction) pushChap01Bookmark: (id)sender{
[BookmarksViewController.bookmarksArray addObject:@"String"];
}
Now when I do this i get an "expected ':' before '.' error".
It doesn't have a problem when I use '[bookmarksArray addObject:@"String"];' from within the implementation file containing the array. Although what I want to do is add the string from another view controller when a command button is pressed.
I noticed that the following person is having the same problem:
http://www.iphonedevsdk.com/forum/ip...ple-views.html
Any help anyone could provide would be much appreciated as this is really bugging me.
Thank You
Carl