Auto layout in iOS - autolayout

image 1
image 2
In my iPad app, on a View controller an image view and textview are present.
Sometimes the image is null so no need to show image in that case (in UI the textview becomes bigger and come in the place of image view also).
For this what can I do?
Please help me.

plz create a outlet of imageheight
like this
Set height UILabel to 0
IBOutlet NSLayoutConstraint *imageheightCont;
when you want image hidden set
imageheightCont.constant = 0;

Related

Set overlay for a background page in javafx

I need to set the background overlay to grey as shown in the image below when a popup is displayed. I have set the background page as the owner page to the popup. So other times when the popup is not displaying it has be normal. I was not able to achieve this. Please someone guide me.
A bit late... but you can try and use ColorAdjust in JavaFX:
ColorAdjust dim = new ColorAdjust();
dim.setBrightness(-0.4);
stage.getScene().getRoot().setEffect(dim);
Set it on the stage you desire and it should work.

ViewController max width / mask?

First of all I want to say that I didn't make this myself but I have to edit this code for a friend of mine.
So there is a storyboard with a ViewController called 'PressViewController'.
In this view there are many images side by side. When I go to 'Utilities' > 'Attributes' the 'Width' of this ViewController is set to '10000'.
In the ViewController I can only see a few images. There are like 20 images and I only can see 15. Although I can't scroll in this ViewController there is a way to add more images to it, but I can't find it.
In the 'PressViewController.m' there is a rectangle drawn.
scrollview.contentSize = CGSizeMake(19170, 450);
scrollview.scrollEnabled = YES;
scrollview.backgroundColor = [UIColor clearColor];
The rectangle drawn is '19170' width. This is lager than the ViewController.
So my question is. How can I add more images to my ViewController?
I'll hope someone can help me out. Thanks instead :)

UISearchBar in UINavigationBar changes width when rotating orientation

This is driving me crazy. I am creating a splitview app on iPad.
I have created a searchBar inside the UINavigationBar - something like this...
UISearchBar *searchBar = [[UISearchBar alloc] initWitFrame:CGRectZero];
[searchBar setPlaceHolder:#"Search"];
[searchBar sizeToFit];
[searchBar setDelegate:self];
[self.navigatioItem setTitleView:searchBar];
this works just fine for me displaying the UISearchBar like this...
I also have this UIBarButtonItem set to show Master navigation controller in sidepane.
The problem happens when the device rotates to landscape and the UIBarButtonItem gets hidden. Then the searchBar appears like this...
there is some space on sides which appears to be there since the barButtonItem got hidden and the size of search bar couldn't be updated.
Furthermore, when I rotate the device again, here's what happens to UISearchBar
How can I update the size of searchbar once it has been added to UINavigationBar. Even using autoResizingMask does not work.
searchBar.autoResizingMask =UIViewAutoresizingFlexibleWidth;
What am I doing wrong over here?
I had about the same problem (it wasn't searchbar, but some UIView), and that's how I solved it:
Try creating it with fixed size that won't change. I mean if your navbar minimum size is (for example) 320pt, and barbutton is about 30pt, and you need searchbar to be placed right in the middle (which, BTW is not standart, AFAIK), you'd have to make it 320 - (30+10)*2 = 240pt. Searchbar would be placed right in the middle and will have enough place left free.
This way it will neither change it's size, nor it will affect other items.
Or I would suggest you placing it at right position, not in the middle.
Hope it helped.

place image button over the image background on android

in my app i have a background image and need to place an image button at the specified location of the background image.i did by using frame layout with android:layout_gravity,layout_alignBottom and marginLeft and right properties. please refer image no :1
i set it for one emulator and it works but i get wrong when launch other emulator of different size so how to set image view over a background image so that imageview not changes its position for any size of screen.
Is there any possibilities to trigger action find by touching image button on the screen(both background image and image button combined as single image - please refer Image no 2)
For this kind of problem, I would think that the best solution in order not to have problem with the screen sizes/densities would be to have different images for the play phase, stop etc.
Thus having:
microphone with play button: 1 image
microphone with stop button: 1 image
microphone with play selected button: 1 image
Etc. and handling the user events.
Hope this helps!

Visually arrange subviews in a large UIScrollView

One of the screens in my app has to be vertically scrollable. Its contents is more or less static, but it doesn't fit on the phone's screen (hence the scroll view). I'm using a UIScrollController as a top view, and I'd like to use the storyboard editor in Xcode to lay out all the views in it. Can I do that? I can obviously drop things on the visible part of my UIScrollController, but can I put more views "below the fold" visually?
There is another way to do it that is different from the answers given in the link in the comment above which I believe is easier because it allows you to see your whole content view at full size and design it in Storyboard.
1)Place a UIScrollView as the root view of the controller.
2) Click on the View Controller in storyboard and goto the
Attribute Inspector and change the Size to Freeform
3) Click on the Scroll View in storyboard and goto the Size
Inspector and change the Width & Height to as big as you need.
(2,000 x 4,000)
4)Place a UIView as a subview of the scrollview, this will be your
Content View where you will design your screen and put all your
subviews. Don't forget to set the contentSize of the scrollview to
the size of this view in viewDidLoad.
5) Click on the UIView from #4 and in the Size Inspector set the Struts and Springs so
this view is not resized .
6) Design the rest of the screen
The trick is in #3 & #5 setting the size of the scrollView to really large so you can design. When this viewController is loaded into the iPhone the Struts & Springs will resize the scrollView to the size of the iPhone screen, but the contentView will stay large.
It's possible finally in Xcode 11!
Select some view inside your scroll view in the View Tree and then scroll with your touchpad/mouse:

Resources