UIPageControl分页控件和 UIAlertView提示框

/*_____________________________UIPageControl_____________________________*/
- (void)_initPageCtrl {

    UIPageControl *pageCtrl = [[UIPageControl alloc] initWithFrame:CGRectMake(20, 380, 200, 20)];
//    pageCtrl.backgroundColor = [UIColor redColor];
    //设置总页数
    pageCtrl.numberOfPages = 4;
    //设置当前所在页数
    pageCtrl.currentPage = 1;
    <span style="color:#cc0000;">//设置图标的颜色(未选中)</span>
    pageCtrl.pageIndicatorTintColor = [UIColor blackColor];
    
    //添加点击事件
    [pageCtrl addTarget:self action:@selector(pageAction:) forControlEvents:UIControlEventValueChanged];
    
    [self.view addSubview:pageCtrl];
    
}

- (void)pageAction:(UIPageControl *)pg {

//    NSLog(@"%d",pg.currentPage);
/*_____________________________提示框_____________________________*/
//   1. UIAlertView
//    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示"
//                                                        message:@"确定推出吗?"
//                                                       delegate:self
//                                              cancelButtonTitle:@"取消"
//                                              otherButtonTitles:@"确定",@"按钮1", nil];
//    
//    //窗口样式
//    alertView.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;
//    //显示提示框
//    [alertView show];
    
    UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"提示"
                                                             delegate:self
                                                    cancelButtonTitle:@"取消"
                                               destructiveButtonTitle:@"确定"
                                                    otherButtonTitles:@"其他1", nil];
    //添加到当前视图上显示
//    [self.view addSubview:actionSheet];  错误
    [actionSheet showInView:self.view];
    
}

#pragma mark -UIAlertView delaget

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 0)
    {
        NSLog(@"点击取消了");
    }
    else if (buttonIndex == 1)
    {
    
        NSLog(@"点击确定了");
        
        UITextField *textField1 = [alertView textFieldAtIndex:0];
        NSLog(@"textField1:%@",textField1.text);
        
        UITextField *textField2 = [alertView textFieldAtIndex:1];
        NSLog(@"textField2:%@",textField2.text);
        
    }
    
}

#pragma mark -UIActionSheet delaget
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {

    NSLog(@"buttonIndex:%d",buttonIndex);
    
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值