iphone - 我如何从发件人那里得到标签值

标签 iphone objective-c iphone-sdk-3.0

- (IBAction)onClick1:(id)sender {
    // Make sure it's a UIButton
    if (![sender isKindOfClass:[UIButton class]])
        return;

    NSString *title = [(UIButton *)sender currentTitle];
}

我知道如何获取标题和其他当前值,但我不知道如何获取标签属性的值。

最佳答案

我这里有一个测试项目,我刚刚用过:

NSInteger i = [sender tag];

关于iphone - 我如何从发件人那里得到标签值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1422620/

相关文章:

iphone - 如何自动关闭UIActionSheet

ios - 如何从另一个 iPhone 应用程序启动 MobileIron Web@Work 应用程序?

iphone - RestKit - 加载一个简单的数组

iphone - 使用 Parse 从应用程序内打开和关闭推送通知

ios - 检测文件是否在 iCloud Drive Trash 中

objective-c - presentViewController - 查看纯黑色,未调用 viewDid___ 方法

iphone - 如何使用 iOS 4.1 SDK 中新的 UIKeyboardTypeDecimalPad 功能

ios - cell.contentView systemLayoutSizeFittingSize : does not work for dynamic height tableview

iPhone操作系统: Strategies for high density image work

iphone - iPhone 中的自定义字体