我想從控制器視圖推動到另一個從第一個視圖控制器中選擇一個UILabel時,但我沒有找到左側觸發的segue在連接檢查員。推送到另一個視圖控制器時,在iOS中選擇一個UILabel
但是當我選擇一個UITableViewCell,我可以看到左側的觸發SEGUE如下面的圖片所示:
我想從控制器視圖推動到另一個從第一個視圖控制器中選擇一個UILabel時,但我沒有找到左側觸發的segue在連接檢查員。推送到另一個視圖控制器時,在iOS中選擇一個UILabel
但是當我選擇一個UITableViewCell,我可以看到左側的觸發SEGUE如下面的圖片所示:
,你將不得不使用UIGesture來做到這一點
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
[urLable addGestureRecognizer:singleTap];
-(void)handleSingleTap
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
ViewController* viewController = [storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
[self.navigationController pushViewController:viewController animated:YES];
}
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
[urLable addGestureRecognizer:singleTap];
-(void)handleSingleTap
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
ViewController* viewController = [storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
[self.navigationController pushViewController:viewController animated:YES];
}
除了邦妮的答案,你可以創建一個手動segue在故事板(由ctrl-從一個場景拖動到另一個場景,然後在屬性檢查器中給它一個唯一的標識符),然後在手動啓動該方法的handleSingleTap
方法中。然後,該方法將僅僅是:
-(void)handleSingleTap
{
[self performSegueWithIdentifier:@"yourSegueID" sender:self];
}
ü可以具有觸發Seques僅當一類屬於UIResponder,UILable不是UIResponder .. – 2013-05-08 11:08:42
如果我想推到花葯視圖控制器當我選擇標題,我在哪裏放這個標題?如果uilabel不起作用? – CarinaM 2013-05-08 11:13:50
可能是,只是有一個UIButton,並讓它看起來像UILabel ..或你可以隨時將GestureRecognizers添加到標籤.. – 2013-05-08 11:26:50