Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone Can';t将UITableViewCell didSelectRowAtIndexPath数据传递给另一个视图控制器_Iphone_Objective C_Ios_Uitableview_Uiviewcontroller - Fatal编程技术网

Iphone Can';t将UITableViewCell didSelectRowAtIndexPath数据传递给另一个视图控制器

Iphone Can';t将UITableViewCell didSelectRowAtIndexPath数据传递给另一个视图控制器,iphone,objective-c,ios,uitableview,uiviewcontroller,Iphone,Objective C,Ios,Uitableview,Uiviewcontroller,我目前在主视图控制器中有一个UITableView。我希望将所选行的数据传递给项目中的另一个视图控制器 这是我到目前为止得到的,尽管有一个错误。为什么会这样?我在.h文件中引用了类和头文件。 我非常感谢您的帮助,因为我已经尝试了我能想到的一切。非常简单,我认为note是一个UILabel Simply synthesize the object in the destination view. It will work fine... like: in .h @property(nona

我目前在主视图控制器中有一个UITableView。我希望将所选行的数据传递给项目中的另一个视图控制器

这是我到目前为止得到的,尽管有一个错误。为什么会这样?我在.h文件中引用了类和头文件。


我非常感谢您的帮助,因为我已经尝试了我能想到的一切。

非常简单,我认为note是一个UILabel

Simply synthesize the object in the destination view.
It will work fine...

like:
in .h

 @property(nonatomic, retain) UILabel *note;

in .m 
@synthesize note;
根据你的错误 请在AddNote中使用此代码。h文件

     NSString  *noteStr; //Ios 4
     IBoutlet   UILabel *note;


@property(nonatomic, retain) NSString  *noteStr; //Ios 4
@property(nonatomic, retain) UILabel *note;



@property(nonatomic, strong) NSString   *noteStr;
 @property(nonatomic, strong) UILabel *note;   //Ios 5
补充说明。m文件

@synthesize note,noteStr;

self.note.text=noteStr; //in ViewWillAppear
有时应用程序会崩溃,因为内存不足。如果您在Ios 4中工作,请更正此代码

an.noteStr - [selectNote retain];

非常简单,我认为note是一个UILabel

根据你的错误 请在AddNote中使用此代码。h文件

     NSString  *noteStr; //Ios 4
     IBoutlet   UILabel *note;


@property(nonatomic, retain) NSString  *noteStr; //Ios 4
@property(nonatomic, retain) UILabel *note;



@property(nonatomic, strong) NSString   *noteStr;
 @property(nonatomic, strong) UILabel *note;   //Ios 5
补充说明。m文件

@synthesize note,noteStr;

self.note.text=noteStr; //in ViewWillAppear
有时应用程序会崩溃,因为内存不足。如果您在Ios 4中工作,请更正此代码

an.noteStr - [selectNote retain];

声明静态变量以供全局使用。 使用关键字extern

Create Common.h

extern NSMutableArray *gMyBasketCollectionList;


common.m

NSMutableArray *gMyBasketCollectionList;


Use This Mutable Aarray to Store Your Data and Display in Any other
include common.h in First View And SecondView 
Add Object to mutable Array in First View And 
Show SecondView And Display access that Array

声明静态变量以供全局使用。 使用关键字extern

Create Common.h

extern NSMutableArray *gMyBasketCollectionList;


common.m

NSMutableArray *gMyBasketCollectionList;


Use This Mutable Aarray to Store Your Data and Display in Any other
include common.h in First View And SecondView 
Add Object to mutable Array in First View And 
Show SecondView And Display access that Array

但有一件事,我把
[an.note setText:selectedNote]除了文本在其他视图中没有实际更改之外。出了什么问题?好吧,但是你可以在其他视图中使用NSString,然后在该视图中分配字符串值将很容易。我的意思是,不要直接从当前视图将字符串值分配给标签。如果我这样做,文本就是空的:(我想你没有用xib连接对象。但是有一件事,我把
[an.note setText:selectedNote];
除了文本在另一个视图中没有实际更改之外。出了什么问题?好吧,但是您可以在另一个视图中使用NSString,然后在该视图中分配字符串值将很容易。我的意思是,不要直接从当前视图将字符串值分配给标签。如果我这样做,文本就是空白的:(我想你没有把这个物体和xib联系起来。