uinavigationbar

Cant change navigation bar height ios 11

微笑、不失礼 提交于 2021-02-18 19:12:27
问题 I cant change navigation bar frame in ios 11. Here is sample of my code for ios 10: if let navigationBar = self.navigationController?.navigationBar { let frame = CGRect(x: navigationBar.frame.origin.x, y: navigationBar.frame.origin.y, width: navigationBar.frame.width, height: navigationBar.frame.height + 100) navigationBar.frame = frame } ios 10 and ios 11 screenshots respectively 回答1: Changing the height of the UINavigationBar is no longer directly supported in iOS 11 (see here, here & here)

How to create a left aligned title with prefersLargeTitles in navigationBar?

巧了我就是萌 提交于 2021-02-08 10:40:34
问题 I'm using prefersLargeTitles on my navigation bar, When it collapse, I want to align the title to the left of the navigation bar, What I did is I create a leftBarButtonItem with a custom view of label and set the title color to .clear , the problem is, that label is visible even if the large titles didn't collapsed yet. This is my code for adding navigation item as my title let label = UILabel() label.textColor = UIColor.black label.text = "my left title" self.navigationItem.leftBarButtonItem

Hide UINavigationController's navigationBar when the root controller is a UIHostingController

别说谁变了你拦得住时间么 提交于 2021-02-08 09:10:13
问题 I am struggling to hide the navigationBar , which would properly be hidden if the root controller wasn't a SwiftUI UIHostingController . I tried the following: Setting navigationController.isNavigationBarHidden = true after creating it, at viewDidLoad and viewWillAppear . Adding both .navigationBarHidden(true) and .navigationBarBackButtonHidden(true) for the UIHostingController 's rootView . Could it be an Apple bug? I am using Xcode 11.6. All my attempts together: class LoginController:

Hide UINavigationController's navigationBar when the root controller is a UIHostingController

有些话、适合烂在心里 提交于 2021-02-08 09:09:05
问题 I am struggling to hide the navigationBar , which would properly be hidden if the root controller wasn't a SwiftUI UIHostingController . I tried the following: Setting navigationController.isNavigationBarHidden = true after creating it, at viewDidLoad and viewWillAppear . Adding both .navigationBarHidden(true) and .navigationBarBackButtonHidden(true) for the UIHostingController 's rootView . Could it be an Apple bug? I am using Xcode 11.6. All my attempts together: class LoginController:

How to control multiple navigation controller in an iOS project

荒凉一梦 提交于 2021-02-08 06:40:22
问题 The structure of my project is as follows. Initially when the user is registering or trying to login the initial navigation controller should work and after successfully registering / loggin in the user should be taken to first tab of tab bar controller. But the issue that i am facing is that i am getting 2 navigation bars in the tab bar view. Can someone guide me how to implement this in the correct way. Thanks in advance 回答1: Make one of the two navigation controllers from tabbar to initial

How to control multiple navigation controller in an iOS project

对着背影说爱祢 提交于 2021-02-08 06:39:20
问题 The structure of my project is as follows. Initially when the user is registering or trying to login the initial navigation controller should work and after successfully registering / loggin in the user should be taken to first tab of tab bar controller. But the issue that i am facing is that i am getting 2 navigation bars in the tab bar view. Can someone guide me how to implement this in the correct way. Thanks in advance 回答1: Make one of the two navigation controllers from tabbar to initial

iPhone: Possible to change the color of just the prompt of the UINavigationBar?

倾然丶 夕夏残阳落幕 提交于 2021-02-08 05:56:09
问题 I'm wondering if I can change the background color of just the prompt of the UINavigationBar (e.g. to red, while the rest of the navigation bar stays black), so I can use the prompt property of the UINavigationItem to display status / error messages as a one-liner. 回答1: Nope. But you can set the prompt to an empty string, and place a red-colored label on top of it. 回答2: This is an old question, but since the introduction of appearance there is a much easier way to setting prompt color (and

How to detect a click event in a UIWebView

老子叫甜甜 提交于 2021-02-08 03:05:26
问题 I have a UITableView that loads content into a UIWebView like this: //MainViewController.m - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { CGRect bounds = [ [ UIScreen mainScreen ] applicationFrame ]; UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:bounds]; UIWebView *htmlView = [ [ UIWebView alloc ] initWithFrame:[scrollView bounds]]; htmlView.frame = CGRectMake(10,10,280,360); NSURLRequest *requestObj = [NSURLRequest

How to detect a click event in a UIWebView

本秂侑毒 提交于 2021-02-08 03:02:00
问题 I have a UITableView that loads content into a UIWebView like this: //MainViewController.m - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { CGRect bounds = [ [ UIScreen mainScreen ] applicationFrame ]; UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:bounds]; UIWebView *htmlView = [ [ UIWebView alloc ] initWithFrame:[scrollView bounds]]; htmlView.frame = CGRectMake(10,10,280,360); NSURLRequest *requestObj = [NSURLRequest

How to detect a click event in a UIWebView

醉酒当歌 提交于 2021-02-08 03:01:52
问题 I have a UITableView that loads content into a UIWebView like this: //MainViewController.m - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { CGRect bounds = [ [ UIScreen mainScreen ] applicationFrame ]; UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:bounds]; UIWebView *htmlView = [ [ UIWebView alloc ] initWithFrame:[scrollView bounds]]; htmlView.frame = CGRectMake(10,10,280,360); NSURLRequest *requestObj = [NSURLRequest