[英]CBCentralManagerOptionShowPowerAlertKey AlertView / Alert Controller OK Button
在該應用程序中,我正在使用藍牙低功耗(BLE)技術在兩個不同的iOS設備上創建具有“遙控”功能的視頻播放器,其中一個設備是視頻播放器,另一個設備正在發送消息以進行播放,暫停,快退等我在這里使用CBCentralManagerOptionShowPowerAlertKey創建了中央管理器。
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], CBCentralManagerOptionShowPowerAlertKey, nil];
centralManager = [[CBCentralManager alloc]initWithDelegate:self queue:nil options:options];
如果設備的藍牙設置未打開(我得到的那個具有粗體字體),則將彈出類似於此視圖的警報視圖/警報控制器。
CLBeaconRegion,如何關閉警告:打開藍牙以允許*連接到附件
除了resignFirstResponder之外,我還想向OK按鈕添加更多功能。
我缺少什么需要修改此警報視圖/警報控制器中的“確定”按鈕的功能? 我已斷點並記錄了方法,但仍然無法捕獲:
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
NSLog(@"Button Index =%ld",(long)buttonIndex);
}
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"%ld", (long)buttonIndex);
}
-(void)alertViewCancel:(UIAlertView *)alertView
{
NSLog(@"alert view cancel");
}
在centralManagerDidUpdateState:方法中,您將創建alertview
在alertView:clikedButtonAtIndex中:您將覆蓋代碼
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {NSLog(@“%ld”,(long)buttonIndex); }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.