응용 프로그램 대리인의 NSmutable 배열을 사용하여 객체를 저장하고 액세스하는 데 문제가 있습니다. 나는 다른 웹 사이트 양식과 오버레이 페이지 스택을 시도했지만 아직 해결 방법이 없습니다. 다른보기에서 배열 데이터에 액세스 할 수 싶습니다. 현재 나를 위해 일하는 것은 없습니다.NSmutablearray에 객체를 저장하는 방법
Heres my code.
AppDelegate.h :
@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
NSMutableArray* sharedArray;
}
@property (nonatomic, retain) NSMutableArray* sharedArray;
ViewController.h :
#import "AppDelegate.h"
-(void)viewDidLoad{
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSMutableArray *model = appDelegate.sharedArray;
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[dict setObject:@"hello" forKey:@"title"];
[dict setObject:@"urlhere" forKey:@"thumbnail"];
[model addObject:dict];
NSLog(@"submitted to array: %@",model);
}
내 생각 엔 배열을 만들지 않는다는 것입니다. –