2011-04-27 63 views
0

我已经创建了我自己的班级,calles cls_myClass。iPhone自己的班级,超出范围

**cls_myClass.h** 

@interface cls_myClass : NSObject { 
    NSString *i_something; 
} 
@property (nonatomic, retain) NSString *i_something; 
-(NSString *) get_something; 
@end 

在我的RootViewController中我有一个计时器,一个数组和一个tableview。

**RootViewController.h** 

@interface RootViewController : UITableViewController { 
    MSMutableArray *i_array; 
    NSTimer *i_timer; 
} 
... 
@end 

现在我想补充的timerintervall一些新值i_array:

**RootViewController.m** 
cls_myClass *dummy = [[cls_myClass alloc] init]; 
[dummy addSomething:@"test"]; 

[i_array addObject: dummy]; 
[self.tableView reloadData]; 

功能 - (NSInteger的)的tableView:(UITableView的*)的tableView numberOfRowsInSection从i_array

返回物品的正确数量

现在我想从i_array的项目,把它们放到的tableView

**RootViewController.m** 
- (UITableViewCell *)tableView(UITableview *)tableView cellForRowAtIndexPath(NSIndexPath *)indexPath { 
//... 

int *max = [i_array count]; 
int *idx = indexPath.row; 

cls_myClass *dummy = [i_array objectAtIndex:idx]; 

NSString *something = [dummy get_something]; 
} 

问题是,var的东西超出范围,但我不知道为什么...

也许有人可以帮助我吗? :)

感谢 希伯特

回答