Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/95.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 更改警报按钮以打开屏幕_Ios_Objective C_Uitableview - Fatal编程技术网

Ios 更改警报按钮以打开屏幕

Ios 更改警报按钮以打开屏幕,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我目前有一个警报按钮,我想改变,所以我想用这个按钮,而不是点击一个单元格进入它 - (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityButtonWithIndex:(NSInteger)index { switch (index) { case 0: { NSLog(@"More button was pressed"); UIA

我目前有一个警报按钮,我想改变,所以我想用这个按钮,而不是点击一个单元格进入它

- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityButtonWithIndex:(NSInteger)index
{
    switch (index) {
        case 0:

    {
        NSLog(@"More button was pressed");
        UIAlertView *alertTest = [[UIAlertView alloc] initWithTitle:@"Hello" message:@"More more more" delegate:nil cancelButtonTitle:@"cancel" otherButtonTitles: nil];
        [alertTest show];

        [cell hideUtilityButtonsAnimated:YES];
        break;
    }
我如何将其与此整合:

- (void)tableView:(UITableView *)tableView
    didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    BNRDetailViewController *detailViewController =
                              [[BNRDetailViewController alloc] init];

    // Push it onto the top of the navigation controller's stack
    [self.navigationController pushViewController:detailViewController
                                         animated:YES];
}

如果要通过从警报视图单击来推送新控制器,则必须在警报视图上添加UIAlertViewDelegate和另一个按钮的消息。然后调用ClickedButtonIndex方法

-(void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
{


if (buttonIndex == [alertView firstOtherButtonIndex] && [alertview.title isEqualToString:@"Hello"]) {


    [self.navigationController pushViewController:detailViewController
                                     animated:YES];

  }
}

如果您的意思是希望用户滑动tableview行时显示的按钮按下viewcontroller,而不是显示警报视图,则您需要执行以下操作:

- (void)swipeableTableViewCell:(SWTableViewCell *)cell didTriggerRightUtilityButtonWithIndex:(NSInteger)index
{
    switch (index) {
        case 0:

    {
        BNRDetailViewController *detailViewController = [[BNRDetailViewController alloc] init];

        // Push it onto the top of the navigation controller's stack
        [self.navigationController pushViewController:detailViewController
                                     animated:YES];

        [cell hideUtilityButtonsAnimated:YES];
        break;
    }

如果您的意思是试图使用显示的警报视图上的按钮,则需要添加一个非取消按钮,并实现UIAlertViewDelegate以处理正在单击的警报视图按钮。在处理按钮单击的方法中,可以初始化BNRDetailViewController并按下它。是要实现的UIAlertViewDelegate方法