If I change SuSE's terminfo to 132-column (co#132) and in my Perform .per code specify
SCREEN SIZE 24 BY 132, would I be able to fit more field tags past the 80-column mark and it display them properly?.. I want to cram more stuff into one screen without having to split it up into separate screens. Has anyone done this before?
Assuming you have set INFORMIXTERM=terminfo so Perform uses Terminfo, then yes, what you suggest should work. It is a long while since I last did this, but it worked back in the early '90s on real green (or orange) screens - like Wyse 60 terminals.
Related
Looking for a clean solution to laying out UI programmatically and having it look right on every device. I've tried extending CGFloat to scale numbers depending on the device
extension CGFloat {
func scale() {
// Modifies self by multiplies by the ratio between the initial screen size and the desired screen size
}
}
// usage
view.widthAnchor.constraint(equalToConstant: 20.scale())
I've also tried just creating two different sets of constraints for iPhone and iPad and activating them depending on which device the app is being run on, but this seems unnecessarily verbose.
How can I layout my UI so that it will work on all devices without hacky workarounds. Are there certain types of constraints I should be avoiding? (for example, instead of setting width/height constants, set them to a multiple of the screen's (or some other view's) width/height?)
EDIT: I don't want to over-explain my own situation, so let me re-ask the question. What are some best practices for setting constraints in an application designed for both iPhone and iPad. Is it bad practice to just check if the device is an iPad, and if it is, have constraints just for iPad, and, if not, have constraints for just iPhone.
Your question, as-is, cannot be answered...
Wha does your app do? If it's a photo slide-show, constrain an imageView to the full view and set its content mode to scale-fit. Voila! It "looks good" on all devices!
If your app is more complex than that, you will likely need to make use of all the types of constraints: elements relative to each other; equal to each other; relative/equal with constant adjustments; relative/equal with multiplier adjustments; etc. And you may want different layouts (not just different sizing) based on device+orientation, in which case you'll also want to take advantage of size-class-variations.
In addition, getting an app to "look right on every device" involves much, much, MUCH more than applying constraints.
Should the app use a Tab Bar?
A Navigation Bar?
A combination of them?
Neither?
Should it use text-buttons or image-buttons?
Should it adjust for accessibility and dynamic fonts?
Might it even have different functionality when running on a small screen vs a large screen?
In general, your first step should be hand-drawing every screen and UI element you expect to have - including the activity "flow" - with variations for sizes and orientations, so you are designing the best UI/UX from the beginning. At that point, you begin actual UI construction.
Keep in mind, there are people who can't produce a "Hellow World" app but make a very good living as "App Designers."
Having said all that, though... one approach you almost certainly should not take is:
view.widthAnchor.constraint(equalToConstant: 20.scale())
EDIT
Here is a quick example - based on this article: https://www.raywenderlich.com/1343912-adaptive-layout-tutorial-in-ios-12-getting-started
A simple weather app - constraints set so it looks similar on all iPhone and iPad models:
But, what happens when you rotate the phone?
Little, tiny cloud doesn't look so good. Add trait-variations / size-classes, and we can get:
And, to try and answer your edited question of: "Is it bad practice to just check if the device is an iPad..."?
Yes. It's recommended to design for trait-variations / size-classes so your app will look the way you want in all configurations (hopefully future-proof for the next device that comes out as well).
Is it bad practice to just check if the device is an iPad, and if it
is, have constraints just for iPad, and, if not, have constraints for
just iPhone.
If you're planning for Split-View support, that is definitely a no-go. The code for achieving and handling this is always going to be slightly verbose. There are no one-liners here to achieve what you want.
In your -[UIViewController viewDidLoad] method, you'd want to setup your views with the base trait collection available to the controller's view. This is your starting point.
As and when your App's windows are resized by the OS (imagine going for a fullscreen app in landscape mode to a split-sized app, occupying one-third of the screen): the -[UIViewController traitCollectionDidChange:] method is called on your View Controller. This is where you update your layout constraints.
You can, and should, encapsulate your layout logic in a single method and call it from -[UIViewController viewDidLoad] as well as -[UIViewController traitCollectionDidChange:].
In such a method, I do not recommend checking if the host device is an iPad. You specifically want to look at the active trait collection's horizontalSizeClass & verticalSizeClass properties to determine the values for your layout constraints.
For further information, I suggest you go through the following documentation:
1. https://developer.apple.com/documentation/uikit/uitraitcollection?language=objc
2. https://developer.apple.com/documentation/uikit/uitraitenvironment/1623516-traitcollectiondidchange?language=objc
The 2nd link has a simple example on how to check if you need to update your constraints.
I usually first get the size of the screen and then use percentages of the width/height for the frames
height = view.bounds.height
width = view.bounds.width
mybutton.frame = CGRect(x: width * 0.05, y: height * 0.02, width: width * 0.3, height: height * 0.1)
After two days stuck on this problem I've very close to solving it. What's happening is I have a view that holds buttons/score/best score (labels and buttons). That view is centered horizontally, and it's near enough perfect--it's actually perfect on the iPhone 5 (as shown below).
As you can see from the screenshot I want the score/best score just under the stars, in the storyboard that's the case and on the iPhone 5 it works like that, yet on every other device it doesn't!
Constraints are the bain of my life, any help is greatly appreciated. I will legitimately PayPal you coffee money if you can help me with this.
Why is it that the iPhone 6 is different? I have a feeling it's because the screen size?
I've posted all my constraints and there's actually a lot...mostly auto-generated by Swift.
http://postimg.org/image/efwie4kxl/
Letting Xcode auto-generate those constraints is likely your problem - it'll end up doing whatever it thinks is best, though it is rarely correct. If the part that's bothering you is that you want the score/best score a certain distance from the stars you should be able to fix that by getting rid of the auto-generated constraints for score/best score, and add a new one that constrains the top of score to the bottom of the stars, and if you have an exact distance you want it to sit you can set the constant to that many points. Without getting into the storyboard and seeing the details of your constraints it's not possible to give you a more exact reason as to why it's not looking the way you want.
Try to use the multiplier instead of absolute constraints at the messed up constraints.
Xcode Example
Calculation : spacer.height = 0.1 x window.height
That way it won't mess up your layout. At least thats my experience.
For further information: Apple iOS Developer Library
Hey idk if I am doing something wrong or if I should file a bug report for this.
I initiate UI elements to my main viewcontroller like the following:
knob[7] =[[UIImageView alloc] initWithFrame:CGRectMake(a, b, c, d)];
knobS[7] =[[knobBand alloc] initWithFrame:CGRectMake(a, b, c, d)];
knob[8] =[[UIImageView alloc] initWithFrame:CGRectMake(a, b, c, d)];
Then I do
[self.view addSubview:knobS[7]];
[knob[7] setImage:[UIImage imageNamed:#"knob"]];
[knob[8] setImage:[UIImage imageNamed:#"knob"]];
[self.view addSubview:knob[7]];
[self.view addSubview:knob[8]];
If I put the [self.view addSubview:knobS[7]]; below the other 4 lines, the knob[7] and knob[8] will not show up at all, although they are the same size and only knob[7] is covered by knobS[7]. I thought this is some programming mistake so I didn't investigate this any further because putting said line above the 4 lines worked - until I built the project the third time and this is where it's getting weird:
Now, whenever I build, build&clean, clean&build, ... the project, one of these 3 things happen:
Only knobS[7] is showing
All 3 UI elements are showing
the project builds but when launching it throws EXC_BAD_ACCESS at the setImage: line
And the amount of occurrences is pretty accurately summed up by the order; 1. is happening 60% of the times, 2. 30% and case 3 is happening in 1 out of 10 cases.
I tried rebooting and there isn't a single line of code grabbing the current time or a random value which might affect the outcome of the code. Even after hitting CMD+R twice within 10 sec without changing ANY code I get 2 different results.
Is there any other form of cleaning/building a project which might help here?
EDIT: This behavior is somehow not reproducible in Xcode 7, it's only 6 that causes the problems.
If I put the [self.view addSubview:knobS[7]]; below the other 4 lines, the knob[7] and knob[8] will not show up at all
You're creating three controls that are all the same size. Whichever one is added last will be on top. You may or may not be able to see the others, depending on how the one on top draws itself, whether the background is opaque, etc.
Now, whenever I build, build&clean, clean&build, ... the project, one of these 3 things happen:
Sounds like you've got a bad pointer and perhaps some other errors. If you use an invalid pointer, your app might throw an exception or it might not, depending on whether the pointer happens to point to a valid object. These kinds of problems have a very non-deterministic feel to them because they're very sensitive to tiny changes: where in memory the object was allocated in the first place, when it gets deallocated, whether anything else gets allocated using the same memory, etc.
I tried rebooting and there isn't a single line of code grabbing the current time or a random value which might affect the outcome of the code.
Doesn't matter -- you really can't expect the system to be in exactly the same state between one run of your app and the next.
Is there any other form of cleaning/building a project which might help here?
There's nothing wrong with how you're building the project, and it probably doesn't need to be cleaned either. To help find the problem, enable NSZombies, which will make your pointers to deallocated objects point instead to a small object that will trigger an exception when you try to use the pointer. That should make the problem more obvious and more reproducible.
I have a UIVC loading from a Storyboard which, in turn, loads a Xib. This inner load is causing the VC to take more than a second to load. There is some fancy footwork going on in the inner xib (it loads another xib which has dynamic drawing) but this doesn't appear to be the bottleneck.
According to Instruments, UIFont -initWithCoder is the culprit. (If you drill down further TBaseFont::CopyLocalizedName() is the deepest entry that accounts for the majority of the 1s time)
I'm a bit stumped as the custom font I use occurs all throughout the app with no problems. Any ideas?
Ok the problem was that the custom font was no longer embedded in the app. I had switched to another similar one which looked the same. Weird though as I'd have expected those offending labels to revert back the System font on the device but they did not. Is it possible they were being pulled from the Macbook?
Similar issue here — Hari and gbk hinted me on the right direction.
I found we were using Lucida Grande in one little hidden place (thank you grep), but Lucida Grande is NOT embedded in iOS. I just replaced Lucida Grande with Helvetica Neue, and I gained 3+ seconds at launch time. Impressive.
Had the similar problem - in my case another dev in team just use one more type of font so after merge system cant figure out font and change it for default one - it's take from 1200ms to 2300ms.
Solution - re-setup all fonts on ViewController that cause some freeze.
I am new to IOS development. I am developing an app for IOS 8 devices. I used storyboard for my design yesterday my storyboard showing all UI design but today morning it show blank UIViewController no UI element vision please see in screen shot and very strange thing is that when i run my app all ui element visible in my device. I google but dont find any solution please help me out. Thank you in advance.
It looks to me like you are using size class and you went into a particular size class and added these views. Now you are back in Any size class, so the views are not there (that is why they are greyed out in the document outline at the left). They are available only for that particular size class. If you switch back to it again, whatever it was, you will see them again. Basically, you have created conditional views - the condition being that they are present only when that particular size class situation is the case.
In other words, if you want your layout to apply in the general case, you want to start by creating and editing it under Any size classes. Only then do you switch to a particular size class and modify the layout for that particular size class.
when i run my app all ui element visible in my device
Yes, because on your device the particular size class situation matches the size class you were editing when you added those views. So there they are. That seems to me to prove my guess is right.
I have the same issue while copy a ViewController to another storyboard.
Fixed by following steps:
1: Select the viewController
2: Click on 5th Tab
3: Set the simulated size to Fixed.
Select install:
Since all components [like label,textfield,buttons] are in disable mode, one select Installed check mark its will be enable again adjust constrain accordingly.
The size must be the same, in all xcode storyboard
In my case, it was due to me setting alpha to 0.0 and forgetting it.