2017-02-23 57 views
2

我試圖創建一個自定義alertview類,但我創建視圖完成塊有問題抽頭創建alertview和獲取標籤竊聽

我想是這樣的,

+ (void)alertview:(UIViewController*)vc handler:(void (^)(UITapGestureRecognizer *))callback{ 
    UILabel *lbl1 = [[UILabel alloc] init]; 
    lbl1.text = @"A"; 
    UILabel *lbl2 = [[UILabel alloc] init]; 
    lbl1.text = @"B"; 
    UILabel *lbl3 = [[UILabel alloc] init]; 
    lbl1.text = @"C"; 
} 

當用戶觸摸,例如,LBL2

[RFAlertView alertview:self handler:^(UITapGestureRecognizer *selected){ 
        NSLog(@"selected label is : %@",selected); 
       }]; 
+0

對警報方法中的「UITapGestureRecognizer」沒有任何對象./ –

+0

它不是一個警報,是一個具有更多標籤的自定義視圖 –

+0

selected.view.title –

回答

0

檢查您是否已經UILableUserIneteractionEnabled設置爲YES