我有一个故事,其中包含自定义 View 界面。这是customeview类定义。
@interface CustomTableCellview : UITableViewCell {
UILabel *titleOfPost;
UILabel *userProfileName;
UIImageView* profileImage;
UILabel *countOfFave;
}
@property(nonatomic,retain) IBOutlet UIImageView *profileImage;
@property(nonatomic,retain) IBOutlet UILabel *titleOfPost;
@property(nonatomic,retain) IBOutlet UILabel *countOfFave;
@property(nonatomic,retain) IBOutlet UILabel *userProfileName;
这些所有值都显示在我的表格中。每当用户单击开/关按钮时,我想调用一个函数。这是我的 TableView 类定义。
@interface VIPsScreen : UITableViewController {
NSMutableArray* tableList;
IBOutlet CustomVIPCell *tblCell;
NSMutableArray* chengdArray;
}
我想将所有相关的“userProfileName”存储在数组“hengdArray”中,该数组的 UISWitch 值为“ON”。我将如何解决这个问题。 提前致谢
最佳答案
使用
[switchCtl addTarget:self action:@selector(action:) forControlEvents:UIControlEventValueChanged];
初始化 UISwitch 实例的位置
-(void)action:(id)sender{
}
作为一种回调方法,您应该在其中检查是否已切换并采取操作...
关于iphone - 如何知道点击了 UISwitch 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6749941/