我声明了一个NSString
名为 *strKey的实例,@synthesize
并且我将一个字符串值传递给它。
但是当我想将该字符串发送到另一个班级时。它给了我错误
这是我的代码
在此处为 strKey 分配一个值
-(IBAction)getLocal:(UIButton *)sender
{
[self startDeckDownload];
GroupDeckExpandableViewObject *objConfiguration=[[GroupDeckExpandableViewObject alloc] init];
GroupListCell *celltest=(GroupListCell *)sender.superview.superview.superview;
if(celltest != nil){
celltest.viewDownload.hidden =NO;
celltest.viewGetLocal.hidden=YES;
//objConfiguration.vwWelcome=celltest.viewWelcome;
objConfiguration.vwGetLocal=celltest.viewGetLocal;
objConfiguration.vwDownLoad=celltest.viewDownload;
strKey=[NSString stringWithFormat:@"%d",[sender tag]]; // i am assign one value to the string here.
[delegate setGroupViewConfiguration:objConfiguration withtag:[NSString stringWithFormat:@"%d",[sender tag]]];
}
}
传递给另一个类(使用协议)。
-(void)setDownloadProgress:(float)progress
{
[delegate setDownloadProgress:progress withkey:strKey];
}
这是协议方法的定义。
@protocol groupListCellDelegate<NSObject>
@optional
- (void) setGroupViewConfiguration:(id)objConfiguration withtag:(NSString *)key;
-(void)setDownloadProgress:(float)progress withkey:(NSString *)key;
@end
我在我的GroupView.m
#pragma mark - delegate method
-(void)setGroupViewConfiguration:(id)objConfiguration withtag:(NSString *)key
{
[arrGroupViewConfiguration setValue:objConfiguration forKey:key];
GroupDeckExpandableViewObject *objgetviews=[arrGroupViewConfiguration valueForKey:key];
[tblData reloadRowsAtIndexPaths:[NSArray arrayWithObjects:objgetviews.cellIndexPath, nil] withRowAnimation:UITableViewRowAnimationNone];
// [tblData reloadData];
}
-(void)setDownloadProgress:(float)progress withkey:(NSString *)key
{
NSLog(@"Reloaded...");
progress_percent = progress;
GroupDeckExpandableViewObject *objgetviews=[arrGroupViewConfiguration valueForKey:key];
NSLog(@"%d",objgetviews.cellIndexPath.section);
[tblData reloadRowsAtIndexPaths:[NSArray arrayWithObjects:objgetviews.cellIndexPath, nil] withRowAnimation:UITableViewRowAnimationNone];
// [tblData reloadData];
}
我在这里想念什么?