在这里,我有2个意见:
首先,AppDelegate通过以下代码调用WelcomeVC:
- (void)presentWelcomeViewController
WelcomeViewController *welcomeViewController = [[WelcomeViewController alloc] initWithNibName:@"WelcomeViewController" bundle:nil];
welcomeViewController.title = @"Welcome to My App";
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:welcomeViewController];
navController.navigationBarHidden = YES;
self.viewController = navController;
self.window.rootViewController = self.viewController;
}
Run Code Online (Sandbox Code Playgroud)
因此,在WelcomeVC中,导航栏不显示为navController.navigationBarHidden = YES;。在WelcomeVC中,有一个按钮来调用WebViewVC,如下所示:
- (IBAction)termsPressed:(id)sender {
WebViewController *webViewController = [[WebViewController alloc] initWithNibName:nil bundle:nil];
NSLog(@"Terms of Use");
webViewController.urlPassed = @"http://.../term.html";
webViewController.title = NSLocalizedString(@"Terms of Use", nil);
[webViewController.navigationController setNavigationBarHidden:NO animated:NO];
[self.navigationController presentViewController:webViewController animated:YES completion:^{}];
} …Run Code Online (Sandbox Code Playgroud) 我相信我在 UITapGestureRecognizer 上遇到了一个问题,用于在聊天室区域中点击时关闭键盘以防止或阻止对 previewCancelButton 的触摸。以下是我的相关代码:
基模板VC.m
- (void)addDismissKeyboardGesture {
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissKeyboard:)];
tapGesture.cancelsTouchesInView = NO;
tapGesture.delegate = self;
self.view.tag = 111;
[self.view addGestureRecognizer:tapGesture];
}
- (void) dismissKeyboard:(id)sender {
UITapGestureRecognizer *gesture = sender;
UIView *view = gesture.view;
NSLog(@"%ld", (long)view.tag);
[self.view endEditing:YES];
}
Run Code Online (Sandbox Code Playgroud)
聊天室VC.m
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
//Disallow recognition of tap gestures in the segmented control.
if (([touch.view isKindOfClass:[UIButton class]])) {
NSLog(@"noooooooo");
return NO;
}
return YES;
NSLog(@"yesssssss");
}
Run Code Online (Sandbox Code Playgroud)
输入函数视图.m
- (void)selectedSticker:(NSString *)stickerURLString {
/* …Run Code Online (Sandbox Code Playgroud) objective-c uibutton uigesturerecognizer ios uitapgesturerecognizer
我已经实施了Google登录,但它运行正常但我在按下Google登录按钮后出现在Google授权页面中的应用名称有点问题.我猜它来自bundleId但不确定.有没有办法在不更改bundleId的情况下更改该名称?提前致谢.
我有2个类:Posts类和User类.我一直在尝试查询Posts类,只显示当前用户的帖子.我是这样做的:
[query whereKey:@"user" containedIn:[PFUser currentUser][@"followings"]];
Run Code Online (Sandbox Code Playgroud)
列"followings"是包含当前用户的followId的数组.我的问题似乎在于Posts类中的键@"user"是指向User类的指针并导致此错误:
Error: pointer field user needs a pointer value (Code: 102, Version: 1.2.10)
Run Code Online (Sandbox Code Playgroud)
我该怎么办呢?提前致谢.
编辑1:信息添加
在这里,我提供有关上述两个类的详细信息:
OBJECTID(字符串)----文本(字符串)----用户(指针)----...
objectId(string)---- username(string)---- followings(users'objectId数组)----...