Ios 如何从其他类重新加载表?

Ios 如何从其他类重新加载表?,ios,uitableview,Ios,Uitableview,我正在尝试从另一个类重新加载我的表。但似乎我不能 myclass1.h @interface CalendarViewController : UIViewController <UITableViewDelegate,UITableViewDataSource> { UITableView *tablo; myclass1.m - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexP

我正在尝试从另一个类重新加载我的表。但似乎我不能

myclass1.h
@interface CalendarViewController : UIViewController <UITableViewDelegate,UITableViewDataSource> {


UITableView *tablo;

myclass1.m

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
    }     


// Configure the cell...
cell.textLabel.text=@"mytext";

    return cell;
}

and myclass2.m
`(NSDate*) dateSelected{

    CalendarViewController *cal1=[[CalendarViewController 

alloc]initWithNibName:@"CalendarViewController" bundle:nil];
[cal1.tablo  reloadData];


}
myclass1.h
@界面CalendarViewController:UIViewController{
UITableView*表格;
myclass1.m
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
静态NSString*CellIdentifier=@“Cell”;
UITableViewCell*单元格=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
如果(单元格==nil){
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle重用标识符:CellIdentifier]自动释放];
}     
//配置单元格。。。
cell.textlab.text=@“mytext”;
返回单元;
}
和myclass2.m
`(NSDate*)已选择日期{
CalendarViewController*cal1=[[CalendarViewController]
alloc]initWithNibName:@“CalendarViewController”捆绑包:nil];
[cal1.tablo重新加载数据];
}

我不知道如何解决这个问题。有人能帮我吗?

如果您声明了iVar而不是使用@property和@synthesis,那么您必须自己创建getter和setter

代替标题中的
UITableView*tablo;
,执行以下操作:

@interface CalendarViewController : UIViewController

@property(nonatomic, strong)UITableView *tablo;

@end
然后在实现文件中:

@synthetic tablo=\u tablo;


然后您应该能够访问cal1.tablo

使用单例或静态方法(+)

+ (void) DoSomethingWithTable {
  // ...
}

并使用
[ClassName DoSomethingWithTable]

调用它。它不接受strong。出现错误:未知属性:strong。抱歉。假设您使用的是ARC。请使用retain而不是strong。并确保在dealloc中释放它。