I'm working on an app that shows items when you press the each button a certain amount of times. I want to find a background for the app since plain color isn't looking so good but I can't find out how big the screen is for a perfect resolution picture. Does anyone know the dimensions of the main screen (excluding the App Bar title)?
Use MediaQuery class
var deviceHeight = MediaQuery.of(context).size.height;
I have a very tall image (400px x 50000px, 1.6Mo) that I would like to display inside a scrollView.
When I import it to the images.xcassets, the img preview is blank. The image also doesn't show up in the scrollview (although the scroll bar seems to be ok in term of height).
Any idea what could be the problem? (using a smaller image works fine hence no issue with the code)
Are there any IOS limitations?
Thanks in advance for the help!
Have any one else noticed in iOS7, the translucent navigation bar only shows color underneath if barTintColor is set to default?
I tried setting barTintColor to various different colors, but anything that is below the navigation bar is displayed a a black blur. Whereas if the barTintColor is set to default, all the elements display correctly underneath.
Is there a way to force it to show the correct colors?
You have to use background color instead of tint color.
self.navigationController.navigationBar.backgroundColor = [UIColor yellowColor];
If you are using tint color it changes only barbutton background color change.
In MyTabBarController in the storyboard select the color tint. You will change the button active color background. No idea for the inactive one.
I am creating a UIView containing some text that partially covers a UIImageView. I want the user to be able to read the text and still maintain a perspective on the image underneath. I have tried setting the background color to [UIColor clearColor], but then the background is totally transparent and it is hard to read the text depending upon the image colors.
If I lower the view.alpha=0.5 the whole view including the text is partially transparent. What I'd like is to maintain the text and reduce the transparency of the background partially, allowing the image to show through.
OPTION 1 - USING STORYBOARDS
For those who have their view in a storyboard or .xib, you simply do it in interface builder by selecting the option "Clear Color" for the Background of the view in the Utilities Pane (the pane on the right). "Clear Color" will give the view a completely transparent background.
If you need a background color that is partially transparent, select the desired background color with the color picker and use the Opacity slider at the bottom to set the transparency.
OPTION 2 - USING COLOR ASSETS (AND STORYBOARDS)
Another very useful option is to add colors to your .xcassets library, so that you can use the same color easily in different views. You can make these colors (semi-)transparent as well, here's how:
Open your .xcassets library
Add a Color Set
Give it a useful name and select the color thumbnail
In the Attributes Inspector you can then change the color and use the slider to adjust its opacity
Go back to your storyboard and select the view you need this transparent background color
In the Background option of in the Attributes Inspector you can now select the Color you added to your .xcassets library. This is very useful if you have multiple views across your app using the same background.
In code you can access the colors from your Color Assets using:
SWIFT (UIColor): UIColor(named: "DP Textfield")
SWIFTUI (Color): Color("DP Textfield")
I think what you mean is you want the backgroundColor of your UIView to be semi transparent? If you want white/transparent use this:
myView.backgroundColor = [UIColor colorWithWhite:myWhiteFloat alpha:myAlphaFloat];
else if you want it to be another color use the general UIColor method: +colorWithRed:green:blue:alpha:
This will work.
myView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.7f];
Eventually you already have a color so you could use .colorWithAlphaComponent like this:
let exampleColor = UIColor.blackColor()
overlayView.backgroundColor = exampleColor.colorWithAlphaComponent(0.8)
For Swift 4+ :
Black translucent view:
view.backgroundColor = UIColor.black.withAlphaComponent(0.5)
I believe you should use:
myView.alpha = myAlphaFloat;
myView.opaque = NO;
For Xamarin C#, at this time, the visual storyboard does not have the "opacity" slider of Xcode's storyboard mentioned by Bocaxica.
If you set BackgroundColor for View nameOfView in storyboard, then in your view controller's ViewDidLoad, add this line to set alpha:
nameOfView.BackgroundColor = nameOfView.BackgroundColor.ColorWithAlpha( 0.7f ); // A value between 0 and 1.
Swift 3+
white half transparent:
view.backgroundColor = UIColor(white: 1, alpha: 0.5)
or black half transparent:
view.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5)
I am using WP7 control toolkit transition animation in my app. My app's pages are all light blue in color but when the transition animation (say, turnstile) is used, during the animation, a black background shows up. How can I make this background during transition to be light blue?
I'm assuming your PhoneApplicationPage's have a Background of Blue. If that is the case, then open up App.xaml.cs and find the line that says:
RootFrame = new TransitionFrame();
Directly after that, place the following statement:
RootFrame.Background = new SolidColorBrush(Colors.Blue);
That should ensure that your app looks consistent during animations. You can see a full sample project here: http://wp7-developer.com/quick-tip/quick-tip-ensuring-the-background-color-remains-consistent-during-a-transition/