滑动到新笔尖
我只是想能够滑动到新的笔尖,但我被卡住了。我的代码构建正确,没有错误或警告,但没有任何反应。
这是我的代码
- (IBAction) handleSwipeGesture:(UIGestureRecognizer *) sener {
NSLog(@"swipe left");
if(UISwipeGestureRecognizerDirectionLeft) {
SecondDetailViewController *tempController = [[SecondDetailViewController alloc]
initWithNibName:@"SecondDetailView"
bundle:nil];
newController = [tempController retain];
[tempController release];
}
}
系统看到我正在滑动(它被记录)但它不会转到新的笔尖。 我并没有真正与我的代码结婚,所以如果我需要完全重写它我没问题。
I just want to be able to swipe to a new nib, but am getting stuck. My code builds properly with no errors or warnings, but nothing happens.
Here is my code
- (IBAction) handleSwipeGesture:(UIGestureRecognizer *) sener {
NSLog(@"swipe left");
if(UISwipeGestureRecognizerDirectionLeft) {
SecondDetailViewController *tempController = [[SecondDetailViewController alloc]
initWithNibName:@"SecondDetailView"
bundle:nil];
newController = [tempController retain];
[tempController release];
}
}
The system sees that I am swiping (it gets logged) but it doesn't go to the new nib.
I'm not really married to my code, so if I need to completely rewrite this I'm OK.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您正在视图控制器内处理滑动手势(并且您正在使用导航控制器),您应该执行如下操作:
此行将
tempController
推到导航控制器顶部:如果您想呈现
tempController
模态上,你应该调用它:Assuming you're handling swipe gesture inside a view controller (and you are using navigation controller), you should do something like this:
This line pushes
tempController
on top of the navigation controller:if you want to present
tempController
modally, you should call this instead:创建 newController 对象后,您不会对其执行任何操作。您需要将其推送到导航控制器上,以模态方式呈现,或者抓取视图并将其放在屏幕上。
You are not doing anything with the newController object after you create it. You need to either push it onto your nav controller, present it modally, or grab the view and put it on the screen.