Unable to change the view size in XIB? - ios

I am trying to make the view controller as size as 300x400, i have done following things,
Open the XIB and go to the Size inspector
Changed the width and height properties to 250 and 300
Saved the file and closed interface builder
But its Not working ??

Just double check with your code whether anywhere frame assign programmatically. If NO, just do following step.
1) Clean and build -> Run. If not work, go to second step.
2) Delete app on simulator and run again.

Right click on XIB
Choose open As
chose source code
and change width and height ..

First of all its important to know that how you are checking size is changed or not.
If you are doing addSubview of this resized xib into other view controller than you feel the change in xib. But in case you are using Push view controller than you will not feel the change. Because view controller will show over the window so you can not change the window size.
Note :
If you want to show the resized view as an subview in any other page than you need to take subview in that view & make add subview of the current view.

Hiii #Gautam, this can be possible, you can do the following things,
Clean your project because sometimes it will not recompiled. Run it again. If this not work then you can use 2nd way
Open the source code of filename.xib by using right clicking that xib and perform change to height and width.
Hope this will work for you...
Thank you...

Related

How to make Popup via storyboard(xib?) and programmatically Xamarin.iOS

For some reason i want to know how exactly i can implement Popup in Xamarin.iOS via storyboard and programmatically.
At current moment, i'm doing pretty simple workaround:
Inside designer, i'm dropping additional view(as popup) and configure like that
MyPopupView.Hidden = true;
After some steps(nvm), i'm showing this popup via
MyPopupView.Hidden = false;
And the result is :
Yeah, that is bad and very poor approach, because what if need these 5 guys or more ?
I will not be able to design my ViewController, because it will be stuffed with these views.
Also, for some reason i want to show arrow(see img below) and shadow(outside of popup) for better usability.
That what is exactly i want to do :
or this one(but inside, i want to put for e.g. my xib or VC,where i can drop some other views, like .gif animation):
or this one:
and finally, what i want(this one is amazing) :
Main idea to use storyboard(to make life easy with working on constraints and autolayout),but maybe it can be done programmatically the same.
I think that is possible to do that with UIAlertController , just needs to insert our View , but dunno is that right approach.
Thanks for any advice.
The last two images you posted can be accomplished using storyboards.
Essentially what you to do is create a separate scene/view controller in your storyboard and set it's presentation property to "over current context".
Alternatively you can set the segue to "Show modally" and the presentation property of the segue to "over current context" in Xcode
(for some reason the "Over current context" option doesn't come up in Xamarin Studio (at least not in Xamarin Studio 6) and when you open it back up in XS it will display a "Error while creating this entry" message by the presentation property but it should still work).
The next step is to set the root view to be transparent (background color = clear color) and then have a child view with your content.
If you want the semi-transparent overlay affect then what you can do is have two "sibling" child views one with your content (same as before) and a second view which is constrained to the edges of the root view and has it's alpha property set to something less then 1.
And here's the result...

How to get a portion of a UIImageView around a point

Is it possible to get a portion/area of an UIImageView around a point, either a circular portion of a given radius or quadratic?
While my users are moving a pin on a UIImageView I would like they could see a zoomed area around that point into another UIImageView.
How can I get that portion?
Consider using this project (Swift), or this one (Objective-C).
UPDATE.
I just update code from first link to be compatible with Swift 2 and add some features like #IBDesignable.
So, to get magnifier in your project you need few steps:
Download MagnifyingGlassView and MagnifierContainerView from here and add them to your project.
In Storyboard open your controller and select UIImageView which you want to magnify.
Select Editor->Embed in->View.
Select created view and assign class MagnifierContainerView. Make outlet from this view to your controller.
In viewDidLoad add this code:
magnifierView.magnifyingGlass = MagnifyingGlassView()
Where magnifierView is outlet to view you created in step 3.
Colour, width or size you can specify through Attributes inspector for MagnifierContainerView in InterfaceBuilder.
Thats all. Complete example you can find here. Hope it'll help.

Size class initially unknown

I am trying to setup my UI on my universal app. I have a storyboard setup with size classes, a fairly simple UI. I have my view controller with a view in. Inside this view, I draw a chart so this can only be updated using setFrame.
This is where my problem begins. I set my graph to be the screen width. However, when the view initially runs, the size class seems to be unknown.
As the default 'Any' size in my storyboard is 600x600. My view thinks it should draw 600 wide on my iPhone, which clearly isn't this wide.
It is only after I physically move the iPhone to toggle an orientation change, that it updates and recognises the correct size.
So my question is, how do I prevent this problem? I need my UI to know what size to be from the get go, not just after the user rotates their iPhone.
However, when the view initially runs, the size class seems to be unknown.
It is unknown to the view and the view controller, because at that time the view controller is not yet part of the interface and has no environment. But it is not unknown to UIScreen.mainScreen(). So if you need this information very early, that is who to ask.
However, as you've been advised in a comment, it also sounds like you may simply be doing this too early. Nothing in a view controller's view, including the view itself, has achieved its actual size until viewDidLoad or later.
There are two to prevent this problem
(1) Load your entire method in
-(void)viewDidAppear:(BOOL)animated
{
}
(2) Do the following step
Go to file Inspector
Uncheck "Use size classed

How to make the buttons visible on simulator?

I'm using Xcode 5.1.1. I recently added a background image to my application but the buttons on the view controller aren't visible. When I remove the background image, the buttons become visible again. How to handle this?
If you are not checking the view hierarchy, then do one thing create outlet of you button and then write following code in viewDidLoad.
[self.view bringSubviewToFront:yourButton];
I don't know if you were used xib...
If you are using xib in your project, giving a background image for your button will more easy.
Place a button anywhere you want. Then go to attributes inspector on the right hand side. There you can find a field for changing your background image. Just give the name of your image.
Hope it will helpful for you

Why storyboard constraints are changed automatically?

Friends my project is in ending state ,but even in my backup all constraints are changed i,don't know how and why ,but if i run all is available but in storyboard can't see any thing.
it is storyboard image :
it is simulator image :
how i have to solve this ,i need my previous constraints how its changed automatically ?
No issues, you can get your storyboard clean and restored.
Goto your storyboard, select the particular view controller/ table view controller.
Choose the file inspector on the right side, goto Interface Builder Document section uncheck Use Size Classes
Proceed by choosing Disable Size Classes option from the dialog popup. Find that all your views have been visible now, and there is the possibility of constraint warnings.
Click on the yellow mark to the right side of your view controller, update the constraints one by one.
At the end, your previous viewcontroller/tableviewcontroller state is restored.
If you have more than one viewcontroller/tableviewcontroller has this problem, do the above steps for all.
Note: Don't forget to check the Use Size Classes back.
Happy coding :)

Resources