Change Inactive Tab Bar Colour IOS 7.1 - uitabbarcontroller

I have searched all over the internet and can't seem to find an answer to changing the inactive tab colours from the standard grey, I am able to set the active but i would like the inactive tabs to be a different colour
i am using storyboards in xcode 5.1.1 with embedded tab bar controllers

For iOS7, use this:
//get embedded tab bar controller
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
//get tab-bar
UITabBar *tabBar = tabBarController.tabBar;
//get tab-bar item w.r.t their index
UITabBarItem *tabBarItem3 = [tabBar.items objectAtIndex:2];
//set image for unselected state
[tabBarItem3 setImage:[[UIImage imageNamed:#"maps.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
//set image for selected state
[tabBarItem3 setSelectedImage:[[UIImage imageNamed:#"maps_selected.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
Here, you can give required color to your maps.png(for inactive state) and maps_selected.png(for active state).In short, you have to give the required colors to your images(tab-bar icons). Similarly, you have to define images for all tab-items for both states. Do this in didFinishLaunchingWithOptions: method of your app.
For iOS 6, it is quite short, which is deprecated for iOS7 and later:
[tabBarItem3 setFinishedSelectedImage:[UIImage imageNamed:#"maps_selected.png"] withFinishedUnselectedImage:[UIImage imageNamed:#"maps.png"]];
Hope this works for u! Happy coding!

Related

Mobile Embedded PowerBI not resizing (height) as expected when switching between landscape and portrait

When embedding a PowerBI report into a mobile app, switching the view from portrait to landscape results in an excess of grey space appearing below the report that wasn't there when the report initially loaded in portrait view. Switching back and forth between landscape and portrait does not restore the original/appropriate height inside the iframe it seems.
The report is loaded with the following configuration:
{
type: 'report',
embedUrl: 'https://app.powerbi.com/reportEmbed',
layoutType: models.LayoutType.Custom,
customLayout: {
displayOption: models.DisplayOption.FitToPage
}
...
}
I would have expected the report to maintain the amount of space in the iframe needed to display report content and not have excess grey space remain/present. This seems like something that is being handled inside reportEmbed.*.js. Any assistance would be greatly appreciated.
The scrollbar in the image gives a relative idea of how far down we are in the iframe.
UPDATE (19/07/18): This was tested on an iPhone running iOS 9.3.
FitToPage option maintains the proportions of the page, and might still have gray shoulders remaining for iframes that don't hold the same ratio for height & width.
however, recent feature allows you to make the gray shoulders disappear:
https://github.com/Microsoft/PowerBI-JavaScript/wiki/Transparent-Background

iOS 11 - Navigation Bar loading with half height during push transition

Since updating from Xcode 8.3 to 9, I'm seeing this weird behaviour that during push transition the target controller's Navigation Bar is loading with half height first and then settling with correct height.
Happening on all the screens of different navigation controllers.
Tried enable/disable nav bar translucent, and Safe Area Layout Guides but of no help. Happening only on iOS 11. For new view controllers too.
Screencast showing this behaviour.
Turns out that I'm using an old version of KMNavigationBarTransition library that uses method swizzling to manage navigation bar style during push transition. Update of this library fixed the issue.

Creating Launch Screen.xib for iOS8 ( ... iOS11, Swift 4 and LaunchScreen.storyboard )

I've just found out that in order to be able to have the description for your app in the app store say "This app is optimized for iPhone 6, and iPhone 6 Plus." you need to use a launch XIB or storyboard file for your launch images (per [Apple][1]).
So, I've created a new Launch Screen xib and now I'm a little but since I usually do everything in code and don't use interface builder. I've deleted the default label that is inserted and dropped a UIImageView into the view. Now I'm wondering how would I:
1) Tell the UIImageView to resize to the size of whatever screen it's on
2) Tell the UIImageView to pick ImageA if a 3.5 inch screen is running the app or the ImageB if a 4 inch screen is running the app etc. etc.
Essentially, I'm just trying to get the launch .xib to mimic the behavior of how the launch screen works normally. Would appreciate it if anyone could provide some assistance on this!
You have two options:
You make use of autolayout and give the imageview a fullscreen appearance (distance to top, bottom, left and right equals 0). This would however result in a clipping of the image for certain screen sizes, what you may not want. So you might want to consider (2)
You place the launch screen image into an asset catalog and just put different images into the different size classes.
I found the answer useful.
The old steps in short for creating the LaunchScreen xib for iOS 8 are below the new steps.
With reference to XCode 9, Swift 3 or Swift 4 and LaunchScreen.storyboard following are the new steps.
First step is to create two images for Portrait and landscape mode splash ( png or jpeg ) in your favorite graphic software. ( If your app only support Portrait mode, you may skip Landscape mode image and settings. )
Portrait mode image :-
Create a 'splash-portrait' image with your own full background for size of "width 1125 x height 2436". Note that the background will clip on various sizes of devices.
Whichever info, graphic, you do not wish to be clipped should be created on center of above image in the size of "width 1125 x height 1471". This should always be in center of above full image.
Landscape mode image :-
Create a 'splash-landscape' image with your own full background for size of "width 2436 x height 1125". Note that the background will clip on various sizes of devices.
Whichever info, graphic, you do not wish to be clipped should be created on center of above image in the size of "width 860 x height 1125". This should always be in center of above full image.
Once both the images are ready, you may add it to xcassets or keep in resource.
Now go for the following steps.
1) "LaunchScreen storyboard" is already created with the new project. Open it.
2) Add an Image View on the view.
3) Set the above saved 'splash-portrait' image to image view source.
4) Set Image view 'Content mode' of Image as "Aspect Fill".
5) Add 4 constraints of Image View for Top, Bottom, Trailing and Leading to Superview.
This is done for the portrait mode app splash.
For landscape mode support, do the following extra steps. ( you may refer full answer by #Sakiboy at
https://stackoverflow.com/a/46089856/2641380 )
6) Click the + button next to the Image view source that you set up in step 3.
7) From the pop-up that is now displayed select Regular for both the Width and Height selectors. This is specifying a new adaptive set for iPads that are in landscape. A new image source field will appear with the title wR hR. Add the 'splash-landscape' image to the wR hR Image source field so the storyboard knows to use a different image when in landscape.
8) Now we need to add support for the 'iphone plus' devices when in landscape. So click the + button next to the Image source field again.
9) This time select compact for the height and regular for the width selectors. This is specifying a new adaptive set for “iPhone plus” devices that are in landscape. A new image source field will appear with the title wR hC.
10) Add the “splash-landscape” image to the wR hC Image source field so the storyboard knows to use a different image when in landscape on an “iPhone plus device”.
As iPad devices are "Regular for both the Width and Height", We will see 'splash-landscape' image in iPad for both portrait and landscape mode. Width 860 for displayable content in 'splash-landscape' image will show full content in both portrait and landscape mode.
The old steps in short for creating the LaunchScreen xib for iOS 8.
1) create a new "LaunchScreen xib" from new file --> user interface --> launch screen ( keep auto layout ON ).
2) Add an image view in the xib --> view (main view).
3) set splash image to it ( the image should not be in assets file ).
4) set image as "Aspect Fit" ( if required ).
5) you may also change the "view" (super view) background color as close to background color of image.
6) select the image view, click from menu - editor - pin - bottom space to super view.
7) this will show red error mark near "view" ( super view of image view ).
8) click on the error mark, you will see approximate two auto layout errors.
9) on clicking on the error you will find menu with auto fix the layout errors.
10) on fixing the errors, you will find total four "Constraints" with "vertical" and "horizontal" space between superview and image.
11) now you may test them in different devices or simulators.
Regards.
You can resize the image by setting constraint to the top, bottom, leading and trailing edges of the superview. Just click the imageview and select Editor->Pin the top context menu. You can also set the aspects of the UIImageView by clicking it and setting it to for instance "Aspect Fit". Make sure the ImageView covers the whole screen before setting the constraints, or else you would have to modify the contstraints.
To set different images for different screen sizes, I would guess you have to create a class and modify to the viewWillAppear method to load an appropriate image
Good luck!
Erik
Create a new file. Under User Interface select View. After, you can name your xib LaunchScreen and you can test it out by adding a label with something like “Test Launch” and run the app. You should see the launch screen appear!
The Launch xib can't have a customized class since your app didn't launch when it is displayed.
What I ended up doing is:
use sizing class feature
Create 3 UI images (one per sizing class)
Use auto layout with constrains which apply to each sizing class
So when you display one type of device the width and hight constrains of the other two UIImageView are set to 0

Selected objects on Mac show background highlight instead of bounding rectangle highlight

I have a Qt application that I am porting to mac.
There are some objects (images) shown in QListView or QTableView, in IconMode, that, when selected, in Windows and Linux get highlighted (a rectangle holding the object, which has colored background - gray if the item is selected but no focus, light blue if the item has focus, slightly more intense blue if the item is selected and has focus - this is probably the default behavior for selection, based on selected color scheme).
On mac the only thing that shows is a tiny dot under the object, and if the object in the view is transparent, light blue shows inside the object - but no selection rectangle. Nothing changes if the object has focus, and if the object is not transparent, only the tiny dot under the object shows.
Once objects are moved on the canvas, mac shows selection as needed, on a bounding rectangle, only inside the listview and tableview the bounding rectangle is invisible.
The form was created using the Designer... the listView property QListView.selectionRectVisible is checked.
I can't see what makes that happen... but I have tried
#if defined (Q_OS_MACX)
m_ui->lv1->setAttribute(Qt::WA_MacShowFocusRect, true);
m_ui->lv1->UseCustomSelectionColors(true); // documentation shows this but it doesn't build
m_ui->lv1->setSelectionRectVisible(true);
#endif
for the mac, and it does not make any difference.
What else can I try, to show selection of objects ?
Qt 4.8
Edit: found a site that has an example for a tiled list view... among other things it draws a visible rectangle around the selected items...
It seems like a very complicated way to do something that seems to be already implemented - highlighting a selected object - I will do it if I have to but I am hoping that I do not have to add something too complicated for the mac version, that will not be used in any other platforms...
There has to be a way to use the normal properties and methods of listview and tableview to make sure that the background of the bounding rectangle, not just the background of the item, shows when a selection is made ?
I don't know if this is a typical mac behavior...
Update
While I really try not to overwrite the desired default system behavior, I tried to force list behavior...
#if defined (Q_OS_MACX)
QString stylesheet = "";
stylesheet += "QListView::item:selected:active:hover{background-color:red;}";
stylesheet += "QListView::item:selected:active:!hover{background-color:blue;}";
stylesheet += "QListView::item:selected:!active{background-color:yellow;}";
stylesheet += "QListView::item:!selected:hover{background-color:green;}";
setStyleSheet(stylesheet);
#endif
The problem is, I need the system colors, I cannot define my own since they will not match the rest of the app window...
What are the names of the system colors for hover, select (strong), select (but no focus), select (but not active) ?
I have tried using
stylesheet += "QListView::item:selected:active:hover{background-color:Highlight;}";
In windows, this looks ok - because it probably is not recognized so it is ignored... On mac, still ignored. And I have not seen any other names for backgrounds. I tried it with lowercase as well.
I ended up using a style sheet - as in the update to my question - with hard-coded color values for the osx blue theme.

Why are disabled buttons using high depth colour in CToolBar are just grey boxes?

I've followed the steps from this question:
Higher color depth for MFC toolbar icons?
The code works. But I have another problem - any disabled buttons are just grey boxes.
Once they are enabled - they are exactly as they should be.
I suspect that the CToolBar doesn't know how to grey out the supplied images - can anyone help?
thanks in advance.
CToolBar actually accepts up to three imagelists each to handle the normal, disabled and highlighted states of the button.
To accomplish what I need - just normal and disabled button states. I need two images. One with normal coloured icons and the other with greyed out icons.
Add the images as Bitmap resources to your project - amend and make note of the IDs
Create two imagelists and set them accordingly: (m_wndToolBar is the toolbar in my project)
CImageList imgListActive;
CImageList imgListDisabled;
/* Load your CImageLists */
m_wndToolBar.GetToolBarCtrl().SetImageList(&imgListActive);
m_wndToolBar.GetToolBarCtrl().SetDisabledImageList(&imgListDisabled);
To set the highlighted versions of the toolbar:
CImageList imgListHighlighted;
/* Load your CImageList */
m_wndToolBar.GetToolBarCtrl().SetHotImageList(&imgListHighlighted);
et voila!
Usually two things are necessary to get the high color buttons and the correctly greyed out images:
Always edit the .bmp file for the toolbar outside of VisualStudio.
Add the images to MFC using a call to CMFCToolBar::AddToolBarForImageCollection(IDR_MAINFRAME); in your InitInstance() implementation.
Unfortunately this also means that you have to edit the Toolbar definition directly in the .rc resource file of the application.