AdvancedDataGrid width Issue on Scaling - advanceddatagrid

I need an immediate help with Regards to Flex 4 scaling behavior.
Problem:
In our project we have the custom ADG (AdvancedDataGrid) and a zoomer control in bottom to control it's scaling, the scale value is directly binded to the scaleX & scaleY properties of ADG,
We recently migrated our flex 3 project to flex 4 sdk (compilation only, rest of the code are still using flex 3 MX components), In flex 3 everything used to work fine, The zoomer control used to increase and decrease the ADG magnification, but after the flex 4 migration, the magnification is happenning but the visible width of the ADG is also getting changed, that is causing the empty space to appear (in right) in case of zoom out and extra horizontal scroll bar incase of zoom in. This doesn't happen for Height. Height is always taking 100%.
I compared the UIComponent class in flex 3 vs flex 4 and found significant difference in set scaleX/scaleY methods, perhaps this change is causing this behavior change.
Please advise/help!
Thanks
Abhishek

Related

How do I get the auto-layout to work correctly in xcode?

I am attempting to get the auto-layout to work correctly. For some reason, when I change the size of the device, all of the images and buttons are out of place and don't resize at all. This is true for the 3.5 inch screen, as well as the ipad retina. When I run the simulator, the app shows exactly how it shows in storyboard. Auto-layout should be resizing everything so that this does not happen. please help!
The issue is that constraints don't scale. When you set a constraint height to 200 it will always be 200, even if the screen is only 100 high. So what you need to do is try to set constraints that makes the size dynamically rather then set the constraint height/widths yourself.
For instance, on your first label under the UIImageView set the constraints leading and trailing to 20, then set the label constraint to center horizontally on the UIImageView. No other constraints for the label. This will cause the label to shrink in width since its set to be 20 away from each side. The height will not change since there is nothing "pushing" it to shrink since you are missing a few constraints, but basically you need to use the top, bottom, leading, and trailing, constraints to the UIViewController view in order to "scale" the elements.
If you'd like I could try and set the constraints for you if you upload the project and you can then watch how I did.
Edit
It's hard for me to know what kind of behaviour you'd want, but something has to scale or change size in your set up. The easiest would be to resize the UIImageView. It's basically impossible to make it look exactly alike in every screen size, though, so you'll have to play around a bit with constraints until you understand how they work and how to adjust them according to what you want. One way is to create the layout you want and then connect them to code and scale them depending on size of the screen (this is a bit of a pain, I did that in a project recently and it took a bit of time and effort).
The easiest approach is to make the UIImageView to change its size when it needs to, and add extra space in the bottom. Here is a demo project I threw together earlier. Download here
Profile pic
1) first you set the profile pic image center horizontal to the content view
2) set height and width for the profile pic
3)set top space constraints to content view
Change Profile pic label
1)set central horizontal to profile pic
2)set width and height
3)set vertical space between profile pic
Challenges Accepted label
1) set vertical space to profile pic label
2) set Leading space to container
3) set height
and do same for the below two content . i didnt tested. check it and try
After a long night of struggling, I figured out what I needed to do. I was setting the individual view controllers to have a simulated size of 4.7inch. This made it hard for the constraints to scale across all devices since I was setting the constraints for a specific screen size. However, this would be the way to go if using size classes.
I solved my issue by using the standard 600 X 600 canvas that is available before choosing a specific size. This way, I was able to set constraints that scaled down for the smaller screens, and scaled up for the larger/HD screens. This works perfectly with auto-layout. Hope that helps someone!

Centering with auto layout to work on all screen sizes?

I'm going crazy over xcodes auto layout!! Really need som help now. I made an app with 8 buttons (only to be viewed in lanscape) that I want to look good (or ok) on iPhone 4, 5 and 6/6+.
I want the title and the buttons to be centered horizontally on all devices. I would be nice if the size increased when viewed on iphone 6/6+ but its not necessary. I tried to put the buttons in a seperate view but I only managed to get it to look good on 4 and 5 that way.
(I'm using xcode 6.1)
Click on the link to see the structure of my layout:
http://groupnoir.com/test.html
Please help!
This seems like a lot, but I have found this to work. Create 1 large view that will hold all the buttons. You need to pin edges to the Superview (Editor > Pin). Add 8 views inside that view and evenly space with auto layout (using equal widths or pin to desired width). You should pin all 4 sides of all the smaller views to the larger view and it's neighbors. You can add a button inside each of the 8 views align horizontal/vertical in container (Editor > Align).

Using size classes and autolayout in xcode 6

I'm looking for some help with the new storeyboards and size classes in xcode 6. I'm looking to build a fairly simple interface with a few labels and text field, however I'm having problems making this look correct for the different devices.
As you can see from the attached image iphone 6 picks up the constraints and size set for the iphone, which looks daft (forcing the label for Score, for example, closer to the left because of the constraint) and doesn't make use of the screen size. Is there no way in xcode to build a layout and have it proportionately adjust to the screen size? Buttons and labels increase in size by x amount?
I can build completely separately for ipad and iphone and was happy to do this in previous versions of xcode but this seems to be defeating the whole point of size classes, and even if I was to do this my problem is still the iphone 6 and 6 plus which would pick up the iphone layout and look ridiculous.
I'm tearing my hair out with this so would appreciate any help.
Maybe constraint the lower elements to the bottom of the screen rather than the top. Other than that I think you don't have many options.
You can change your layout for different views using compact and regular widths and heights. Click on wAnyhAny at the bottom of your screen. This will provide a grid view pop up, which lets you customize view for different screen sizes. As you select different boxes, the bottom will tell you what size the view applies to.
You can change four things in a size class:
1. The constant for a constraint
2. If a constraint is installed in the view hierarchy
3. If a view is installed in the view hierarchy
4. The font used for many types of views showing text
This means if you want a different label or constraint for your iPad view, you can add that constraint just for that view using size classes.

How to do this simple thing with XCode's new Auto Layout feature?

Im trying to do something that seems like it should be a no-brainer. But alas, im too dumb to figure this one out. So i need help.
I have an iphone simulator (with a vertical orientation).
The main view has a subview (a blue UIView) that should be displayed in the bottom 25% of the screen. The final rendered screen would basically look like a white screen with the bottom section being blue.
I want the edges of the subview to hug the screen edge. But thats not the part I'm struggling with. The tricky thing is configuring the height of this subview (and the layout of its contents, if any) when I suddenly rotate the orientation of the simulator. If i do this, then everything looks odd.
I would also like to note that what I see in the Interface Builder (with Auto Layout enabled) looks nothing like the app when it loads in the simulator.
PS - for now i will keep playing around with this. maybe i will eventually reach a eureka moment.
* Updated with screen shots *
This is what my layout looks like in Interface Builder:
And this is what it ends up looking like in the simulator:
* Update 2 *
Ok. After updating my post with the screenshots, it dawned on me that the simulator doesn't look like the 4" screen version (even though it does on my computer screen). After running the 4" simulator i can see the the layout just like the IB layout. But this makes me wonder why auto-layout wasn't "smart" enough to adjust for the smaller 3.5" screen.
It looks to me like you have a fixed height constraint from the top edge of the blue view to the superview that is pushing content down - conversely you may have a fixed height view above it that is smooshing things. Try pinning the top edge of the blue view to the superview and lowering the priority or changing it from an equality to a less than equal to constraint.
In IB in XCode you can change the canvas size for iPhone layouts, look for the single button on the right hand side that looks like a rectangle with arrows above and below, or inside it. In the screenshot below it is the leftmost button.
You could simply turn off Auto Layout. Springs and struts can readily make your subview 25% of the superview's height.
Or, you can certainly stick with it, but you'll need to adjust the constraints in code. There's no way to establish such a constraint in the current version of Xcode. Set constraints in IB to pin the box to the bottom of the window and fix the height, setting an outlet for the height constraint. Then in -viewDidLoad, remove the height constraint and add a new constraint to the superview which expresses the height relationship you want.
This isn't to discourage you from learning Auto Layout, but to point out that it's a bit complicated, and that the constraint tools in IB are unintuitive and relatively weak. The WWDC video Introduction to Auto Layout is a good starting point.

Set margins of view xcode

I have been programming android apps for a bit, and I am now making an iphone app. I want to make margins for my view. I would not like to explain my exact situation, but if someone helps me with this I'll be able to figure out what I need to do.
I have two views, I want the first view to take up the entire screen. Then I want another view to always be, lets say 20 pixels from the edge of the screen on all four sides. Is there a simple way to do that in xcode?
Thanks
I assume you're using Interface Builder (now part of Xcode).
Add the view as you suggest - leaving a 20 pixel border around all 4 sides. Set all 6 resize options (flexible height, width, top, bottom, left & right).
Ensure that 'autoresize subviews' is enabled on the parent view.
The view will now resize if the parent view also resizes, leaving a 20px margin as required.

Resources