C cloner7801 Active Member Licensed User Longtime User Jan 10, 2017 #1 Hi How can I change back button font ?
Erel B4X founder Staff member Licensed User Longtime User Jan 11, 2017 #2 You can use your own BarButton for the back key by setting Page.TopLeftButtons. Upvote 0
C cloner7801 Active Member Licensed User Longtime User Jan 11, 2017 #3 Erel said: You can use your own BarButton for the back key by setting Page.TopLeftButtons. Click to expand... Yes, but I want to use iOS default things I found a way to change the page title font But it doesn't change the backbutton font How can I use this ? http://stackoverflow.com/questions/16535507/change-font-of-back-navigation-bar-button Upvote 0
Erel said: You can use your own BarButton for the back key by setting Page.TopLeftButtons. Click to expand... Yes, but I want to use iOS default things I found a way to change the page title font But it doesn't change the backbutton font How can I use this ? http://stackoverflow.com/questions/16535507/change-font-of-back-navigation-bar-button
Erel B4X founder Staff member Licensed User Longtime User Jan 12, 2017 #4 B4X: #if OBJC - (void) ChangeFont { NSShadow *shadow = [[NSShadow alloc] init]; shadow.shadowOffset = CGSizeMake(0.0, 1.0); shadow.shadowColor = [UIColor whiteColor]; [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes: @{NSForegroundColorAttributeName:[UIColor blackColor], NSShadowAttributeName:shadow, NSFontAttributeName:[UIFont boldSystemFontOfSize:12.0] } forState:UIControlStateNormal]; } #End If Call it when the program starts: B4X: Private Sub Application_Start (Nav As NavigationController) Dim no As NativeObject = Me no.RunMethod("ChangeFont", Null) Upvote 0
B4X: #if OBJC - (void) ChangeFont { NSShadow *shadow = [[NSShadow alloc] init]; shadow.shadowOffset = CGSizeMake(0.0, 1.0); shadow.shadowColor = [UIColor whiteColor]; [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes: @{NSForegroundColorAttributeName:[UIColor blackColor], NSShadowAttributeName:shadow, NSFontAttributeName:[UIFont boldSystemFontOfSize:12.0] } forState:UIControlStateNormal]; } #End If Call it when the program starts: B4X: Private Sub Application_Start (Nav As NavigationController) Dim no As NativeObject = Me no.RunMethod("ChangeFont", Null)
C cloner7801 Active Member Licensed User Longtime User Jan 14, 2017 #5 Erel said: B4X: #if OBJC - (void) ChangeFont { NSShadow *shadow = [[NSShadow alloc] init]; shadow.shadowOffset = CGSizeMake(0.0, 1.0); shadow.shadowColor = [UIColor whiteColor]; [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes: @{NSForegroundColorAttributeName:[UIColor blackColor], NSShadowAttributeName:shadow, NSFontAttributeName:[UIFont boldSystemFontOfSize:12.0] } forState:UIControlStateNormal]; } #End If Call it when the program starts: B4X: Private Sub Application_Start (Nav As NavigationController) Dim no As NativeObject = Me no.RunMethod("ChangeFont", Null) Click to expand... thanks Erel! You are wonderful, But How can I change it to my custom font? Upvote 0
Erel said: B4X: #if OBJC - (void) ChangeFont { NSShadow *shadow = [[NSShadow alloc] init]; shadow.shadowOffset = CGSizeMake(0.0, 1.0); shadow.shadowColor = [UIColor whiteColor]; [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes: @{NSForegroundColorAttributeName:[UIColor blackColor], NSShadowAttributeName:shadow, NSFontAttributeName:[UIFont boldSystemFontOfSize:12.0] } forState:UIControlStateNormal]; } #End If Call it when the program starts: B4X: Private Sub Application_Start (Nav As NavigationController) Dim no As NativeObject = Me no.RunMethod("ChangeFont", Null) Click to expand... thanks Erel! You are wonderful, But How can I change it to my custom font?
Erel B4X founder Staff member Licensed User Longtime User Jan 15, 2017 #6 Replace [UIFont boldSystemFontOfSize:12.0] With B4X: [UIFont fontWithName:@"font-name" size:12.0] Last edited: Jan 15, 2017 Upvote 0
C cloner7801 Active Member Licensed User Longtime User Jan 15, 2017 #7 Erel said: This is not the correct way to post an error message. You should copy the text and post the text. If it is large then paste it in a text file and upload it. Click to expand... Sorry Erel, Attached Attachments error.txt 46.8 KB · Views: 255 Upvote 0
Erel said: This is not the correct way to post an error message. You should copy the text and post the text. If it is large then paste it in a text file and upload it. Click to expand... Sorry Erel, Attached
Erel B4X founder Staff member Licensed User Longtime User Jan 15, 2017 #8 The code I posted was wrong. It should be: B4X: [UIFont fontWithName:@"font-name" size:12.0] Upvote 0