0

我有一个 Objects Post 的 NSMutableArray(称为 postArray)。

对象 Post 是:

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>

@interface PostAnnotation : NSObject <MKAnnotation>

@property NSInteger annotationID;
@property NSInteger postID;
@property (nonatomic, copy) NSString* profile;
@end

我将如何更改对象 i 的 postArray.postID 的值?提前致谢!

4

1 回答 1

1

一种替代方法是从数组中转换对象:

((PostAnnotation*)[postArray objectAtIndex:index]).postId = 1234; 

否则,您可以使用此方法:

PostAnnotation *postAnnotation = postArray[index]
postAnnotation.postId = 1234;
于 2013-07-20T17:23:52.130 回答