Anyone know how to configure constraints or whatever, to achieve the correct implementation of a view object for all iPhones sizes?
Let me explain with an example:
In Xcode 6 (iOS 8) you do not have storyboard for iPad and storyboard for iPhone, but you want to implement a UIWebView for iPad and iPhones (3.5, 4, 4.7 and 5.5)
If you want to fill the entire screen with the UIWebView (it is only an example), what do you must do?
I have tried with parameters as "Scale to Fill" in the "Interface Builder", I have tried with:
[self.webView setBounds:self.view.bounds];
You need to specify every size programmatically with "setFrame" ? I do not think so.
Some suggestion?
I solve the problem but I am not happy because I do not understand "Interface Builder Constraints" yet. I am not quiet.
My solution:
UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:webView];
But I would like to know the way to build an "Object View" (UIWebview in example) that fits all screen sizes, and do it through the constraints tool.
Considering the new situation (xCode 6): an unique storyboard for iPad and iPhone.
I found the solution to my question. This is approximately, what I was looking for.
It is a tutorial from Skip Wilson. The link:
iOS8 Constraints and Size Classes
Related
I am working on a existing Qt application and trying to support it on 4K monitor. For scaling the app, I am using "QT_SCREEN_SCALE_FACTOR" and scaling fonts based on logical DPI of screen. Everything is fine till this. Fonts for ribbon, docked windows are ok after scaling. But the font is getting too bigger for floating forms (pop up dialogs) and the docked widgets after undocking (the moment window is undocked, font is becoming bigger). I don't understand why this is happening. Is windows taking control over floating forms and making font bigger? Or am I missing something?
I am not using "Qt::AA_EnableHighDpiScaling" or "QT_SCALE_FACTOR" because I did not find these useful for me.
Has anyone faced this kind of problem?
Please let me know if someone knows about this.
After trying this and that, I found a solution to this problem.
I added'QGuiApplication::setAttribute(Qt::AA_DisableHighDpiScaling);' before creating QApp. And then I just needed to change the font size.
looking for a Weex way to set screen orientation to landscape. Seems like the NAT orientation API simply says what the orientation is. Is this something that should be done in the respective Android or iOS builds?
as API document says weexpack plugin add nat-device-screen this is enough.
How do I configure a Xamarin.Forms app to fill out phones with newer aspect ratios like the Samsung Galaxy S8?
Currently my Xamarin.Forms app looks like the one on the left below. What configuration do I need to change?
Initially, I thought this might have been an issue with Xamarin. However, after further research I found it to be a new configuration for Android apps in general to support the 18:9 aspect ratio.
Here is the Android Developers Blog post describing the updates:
In order to take full advantage of the larger display formats on these
devices, you should consider increasing your app's maximum supported
aspect ratio. To do so, simply declare an android.max_aspect
<meta-data> element in the app's <application> element:
<meta-data android:name="android.max_aspect" android:value="2.1" />
This resolved the issue for me. Related answer here.
My app has a multi-pane tutorial-style view that users swipe through to learn about the app. This is implemented very much as described in this tutorial. Having implemented it for both iOS 7 and 8, I'm comparing how they work, and finding issues with the latter — I'm running Xcode 6 GM here.
It seems that the UIPageViewController is rendering the views after the transition is complete. I overrode the delegate methods to see what was going on:
- (void)pageViewController:(UIPageViewController *)pageViewController willTransitionToViewControllers:(NSArray *)pendingViewControllers
{
NSLog(#"Frame size before: %#", NSStringFromCGRect([(UIViewController*)pendingViewControllers[0] view].frame));
}
- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed
{
NSLog(#"Frame size after: %#", NSStringFromCGRect([(UIViewController*)previousViewControllers[0] view].frame));
}
And here's a sample output:
Frame size before: {{0, 0}, {600, 600}}
Frame size after: {{0, 0}, {320, 568}}
This manifests like so: swipe to the left to pull in the next view, and note a 32-pt white space at the bottom of the new view. Once the transition is complete, it jerks into its proper layout.
Is this a bug in iOS 8, perhaps? I'm all out of guesses at this point.
I figured out you need to base your constraints on the view and not the layout guide of your view controller. This will ensure your view controller respects the constraints you set prior to the transition in a PageViewController.
you can do this like so:
Remember to uncheck "Constrain to margins"
For anyone having this issue, for me it appeared to be that I was laying out views "relative to margin" (a new feature in iOS 8).
Instead of:
Use:
I've been struggling with this for a few days.
I tried to implement it by instantiating the page ViewController from the storyboard. There was a definite resizing occurring. Checking the frame size in
pageViewController:viewControllerAfterViewController
pageViewController:willTransitionToViewControllers
pageViewController:didFinishAnimating:previousViewControllers
The frame size would always change between the calls to 1 and 3. Sometimes before 2 and sometimes after.
If you're also using storyboards, I was able to resolve the issue by extracting the page UI elements into its own XIB file, setting the constraints in IB and then creating the pages with a call to initWithNibName.
Not a complete answer but it returned me to feeling productive.
Hope it helps.
For me solution was to pin top of the tableView to superview:
Editor -> Pin -> Top Space To SuperView (iOS8)
It is a bug in iOS 8 but I found a workaround:
Add an empty view on top of the statusbar in your Storyboard. The height of the view should be as much as the y-value of your object that is being moved.
How can i maintain DPI resolution calculation for various device and UI management for eg,
iPhone having action bar at top/bottom , iPad app has control bar component instead.Is it possible to maintain application in SINGLE CODE BASE.
Please suggest any alternate way to manage
Please help me.
You have a few approaches to take.
First, the Flex Framework basically boils everything down into three different DPIs. 240dpi is most phones. 160dpi is most tablets. And 320dpi is the iPhone 4. Even though the DPIs are not exactly 160, 240, or 320 the framework uses an approximation to figure out the best DPI to use.
Based on that; You can use the Application.applicationDI. Then the Flex Framework will automatically adjust things for different DPI resolutions based on that settings. So, if you design your app for 160; the app will automatically adjust when run on a screen that is 240. It works pretty well.
The second choice is to write your own layout code to handle different assets and positioning. If you use FXG elements, they are vector based and can easily scale to any device. You could consider making all your assets square; which means it will probably look good no matter what DPI you switch it to.