NSString
名前付き *strKeyのインスタンスを宣言し、それに@synthesize
1 つの文字列値を渡します。
しかし、その文字列を別のクラスに送信したいとき。それは私にエラーを与えています
これが私のコードです
ここで strKey に 1 つの値を割り当てます
-(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];
}
ここで何が欠けていますか?