开发者

Swiping on a Label sholud move one view to another

开发者 https://www.devze.com 2023-03-18 20:00 出处:网络
I have a requirement in which I need toswipe on a label andafter swiping on it,it should take me to the other view.

I have a requirement in which I need to swipe on a label and after swiping on it,it should take me to the other view. Will it be pos开发者_StackOverflow中文版sible. The Label should be self explanatory as it should change the color and should get a blinking effect so that the user knows to swipe there.

Please suggest me.

Thanks Rizwan


The best thing to do is to create a gesture and attach that gesture to the uilabel, heres a simple example

UISwipeGestureRecognizer *swipe;
swipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(Gest_SwipedLeft:)];
[swipe setDirection:UISwipeGestureRecognizerDirectionLeft];
[label addGestureRecognizer:swipe];
[swipe release];

Then simply apply your code to push the next nib

-(void)Gest_SwipedLeft:(UISwipeGestureRecognizer *) sender
UI_iPad_View *controller = [[UI_iPad_View alloc] initWithNibName:@"ipadview" bundle:nil];
[[self navigationController] pushViewController:controller animated:YES];

// Cleanup
[controller release], controller = nil;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号