단순히 변경 가능한 배열에 개체를 추가하려고하지만 삽입하지 않습니다. 나는 오류나 아무것도 얻지 않고있다. 그리고 나는 무엇이 계속하고 있는지에 관해 계산할 수 없다.개체가 NSMutableArray에 추가되지 않았습니다. Objective -C
내 주요 델리게이트 파일에서 배열을 이렇게 4 개의 별도의 문자열로 분할했습니다.
NSArray *split=[currentParsedCharacterData componentsSeparatedByString:@"|"];
NSLog([split objectAtIndex:3]);
NSString *date=[split objectAtIndex:0];
NSString *venue=[split objectAtIndex:1];
NSString *event=[split objectAtIndex:2];
NSString *city=[split objectAtIndex:3];
나는 문자열 값을 추적했으며, 분명히 거기에 있습니다.
까지 다음 나는 비어있는 디버거의 배열을 검사 할 때 변경 가능한 배열
[self.promoTabOptionEvents.dates addObject:date];
[self.promoTabOptionEvents.venues addObject:venue];
[self.promoTabOptionEvents.event addObject:event];
[self.promoTabOptionEvents.city addObject:city];
이러한 문자열 값을 추가하려고합니다. 내가 도대체 뭘 잘못하고있는 겁니까?
promoTabOptionEvents 클래스는 당신이 당신의있는 NSMutableArray 인스턴스를 초기화 코드를 추가 할 수이
수입
@interface PromoTabOptionEvents : UIViewController {
NSString *event_headline;
NSMutableArray *dates;
NSMutableArray *venues;
NSMutableArray *event;
NSMutableArray *city;
}
@property(nonatomic,retain)NSString *event_headline;
@property(nonatomic,retain)NSMutableArray *dates;
@property(nonatomic,retain)NSMutableArray *venues;
@property(nonatomic,retain)NSMutableArray *event;
@property(nonatomic,retain)NSMutableArray *city;
-(void)applyLabels;
-(id)initWithTabBar;
@end
#import "PromoTabOptionEvents.h"
@implementation PromoTabOptionEvents
@synthesize event_headline;
@synthesize dates;
@synthesize venues;
@synthesize event;
@synthesize city;
-(id) initWithTabBar {
if ([self init]) {
//this is the label on the tab button itself
//self.title = @"Tab1";
//use whatever image you want and add it to your project
self.tabBarItem.image = [UIImage imageNamed:@"events.png"];
// set the long name shown in the navigation bar
[email protected]"Events";
CGRect bgframe;
bgframe.size.width=320; bgframe.size.height=460;
bgframe.origin.x=0; bgframe.origin.y=0;
UIImage* bgimage = [UIImage imageNamed:@"eventsbig.png"];
UIImageView *imagebgview = [[UIImageView alloc] initWithImage: bgimage];
imagebgview.frame=bgframe;
imagebgview.contentMode=UIViewContentModeScaleAspectFit;
self.view.backgroundColor=[UIColor whiteColor];
[self.view addSubview:imagebgview];
}
return self;
}
mutable 배열을 초기화하지 않았습니다. @synthesize는 그것을 처리하지 않습니까? 당혹스러워해야합니까? – dubbeat
약간만 :-) 속성 정의가 포인터를 정의합니다. nyou는 init 유형 호출이 필요하고 [[NSMutableArray alloc] init] – AlBlue
감사합니다. :) – dubbeat