Is there a good XML-based layout engine for iOS? [closed] - ios

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Storyboards and programmatic UIView creation are not particularly good at defining complicated layouts where some items, such as labels, may have dynamically defined heights. I want a simple XML-based layout engine, like a bare-bones implementation of HTML/CSS, that allows me to define a view using margins, padding, border etc. in the DRY manner to which I've been accustomed with HTML/CSS. Is there any open-source library out there that attempts this?

Y U NO wait for iOS6's AutoLayout feature? ;-)
This will allow you to define constraints and dynamic element heights, width, sizes, margins, paddings… with each other elements.

Though it has so many awesome features like dynamic element heights, width, sizes, margins, paddings. I think AutoLayout is too hard to study, edit, merge, maintain.
You can check BeeFramework. It use xml layout as simple as Android does. It has an XML Interface Builder, you can see the UI when you are writing UI code
And the author is working on another project samurai-native.
It uses Native code and CSS. I think it's more awesome than react-native.

I know this is an old question, but in case it is of interest to anyone - MarkupKit is an open-source project I created specifically to address this type of use case:
https://github.com/gk-brown/MarkupKit
It allows you to build native iOS user interfaces using a human-readable XML markup language, similar to XAML or Android. It supports CSS-like styling via JSON-based "property templates" and provides a collection of UIView subclasses for simplifying autolayout.

Related

Is it crazy to Auto Layout everything in code? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I lay everything out in code, and like the control and ability to copy code easily (when reusability doesn't make sense). I do use lightweight wrappers around NSLayoutConstraint to cut down on verbosity, but I noticed that my files are pretty large because of the required instantiate-then-layout structure for every single view.
Is this crazy? Is using storyboards/XIBs better/faster?
I lay out my views -and their subviews- in code, so I belong to the same school you come from. But as a fellow scholar, take a look at UIStackView, it will save you tons of NSLayoutConstraints work, since you basically place everything as a subview of the StackView -without worrying about constraints-, then only work on the constraints of the StackView in relation to its superView. You still need to work on the UIStackView properties, but it's nothing compared to having to work on layoutConstraints of every single subView of any given view.
I believe there is a 101 ways to skin an app, code, Interface Builder, 3rd party stuff, I don't believe anyone who say their way is the right way -or that someone else's is wrong-, it's simply different schools of life, and some developers are simply code masochists.
This is an opinion question, but I'll weigh in anyway. I'm a senior/lead iOS developer, and I think that aside from doing it as a learning exercise, or in limited cases where there's a good reason, doing your view layout and Auto Layout in code is a very bad idea, and I would not hire somebody who insists on doing it that way.
It's more work in the first place, and much more work to maintain.
If it is written with the code I agree to the opinion of use Masonry(Objective-C) or SnapKit(Swift)
Visual Format Language may also be simple
Xib or storyboard constraints are not suitable for multiplayer development
If personal development xib or storyboard is also a good choice
Maybe you can use Masonry(Objective-C) or SnapKit(Swift) replace NSLayoutConnstrant

When to draw controls manually and when to add via interface builder? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm learning iOS and I've gone through a few tutorials now, and one or two of them had you draw all the controls in the IB, and one or two of them had you create them all programmatically.
This leads me to wonder whether I can safely mix and match these approaches. I know the answer is yes, of course, since it would make no sense otherwise.
But what are the advantages/disadvantages? Particularly with regard to proportions and sizing for different screens, that bit is still an obstacle to me as a beginner.
This is mainly a matter of taste. I like to make my controls in code others prefer the Interface Builder. I see the following advantages for the Interface Builder:
More visual. You can see how you interface will look like while you put it together.
You can use the Preview assistant editor and see you interface without compiling.
You don't have to remember what the options are called because you can scan the checkboxes for what you are searching.
You can faster prototype with storyboards.
Maybe your designer can learn to build the interface using storyboards.
The advantages for code are:
No context shift. All you do is coding.
Still you have less merge conflicts when you are working with a team on a project.
All the options are in one place. In Interface Builder you have to click through all the inspectors to find what you are searching for.
It's easier to post code than screenshots in case you need help on Stackoverflow ;).
If you finde code on github you can see without downloading how the interface is build.
I had a few times that a project could not be opened by Xcode when I opened it in a beta of Xcode because the Interface Builder file structure had been changed.
Code is easier to refactor than storyboards (Thanks #Spectravideo328 for the suggestion in the comments).
It is impossible to inherit from a storyboard scene. I code you can easily make subclasses to reuse code. Using a storyboard you have to make two scenes even if they share 90% of their UI elements.
One thing which is very important: Don't put all you screens in one storyboard. Try to keep the storyboards small. Something between 1-6 screens is working for me with good performance.
There are no such thing like advantages or disadvantages. Just take a example. if you already have those controls to use it via Xcode. why will you code it. We only code things when we need to make special controls or you can edit your controls by connecting your controls to the code(you can google it "how to connect buttons in iOS"). In short, you only create controls when its kind of a special control which is not pre build in Xcode.

iOS drop down view [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I have been searching for drop down view (expand & collapse view) that basically expand when user clicked on it or collapse.
The drop down is basically use to include textview/textfield.
Till now I could not manage to find how to create this drop down view.
What I managed to find is drop down menu which is sort of like an option picker that allows you to select an option. I just wanted to include text only. Is it possible to ask for some pointers regarding this?
Thanks.
I also needed a HTML select-like control (single-selection dropdown list) without breaking the XCode legacy GUI interface across past and future iOS releases.
I ended up coding DownPicker, a lightweight control which does just that combining UITextField and UIPickerView. It can be used either as custom control (UIDownPicker) or also as control wrapper, upgrading any existing UITextField.
Here's how it looks like:
For more info and download you can check this brief tutorial or the GitHub project page (both wrote by me - the project is open-source).
There is no dropdown available in iOS. You should create it with text field and tableview.
Use below links for references:
iOS-Examples--UITableView-Combo-Box
a-simple-drop-down-list-for-iphone
Yes. There is no dropdown component available in ios. And its really frustrating to build a basic component. However, VPPDropDown is there to solve your problem. https://github.com/vicpenap/VPPDropDown
you can see this one too. This library is written with Swift 3
https://github.com/younatics/YNDropDownMenu
http://gabriel-tips.blogspot.in/2011/10/uitableview-display-and-hide-cells-as.html
you can take it as reference, table view is good and efficient way for dropdown. if you got any other way then please let me know..
Adding more options here. People looking for dropdown in iOS can also give VSDropdown a try:
VSDropdown
It automatically controls many stuffs like frame, direction, appearance and dismissal when tapped outside bounds.

iOS - Interface design resources [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I'm building an iOS app and I have all the functionality going already so it's time to sit down and make it beautiful. I'm not very savvy in this area, this is the first app I've made and I'd like some good, up to date or recent, resources/tutorials on iOS interface design.
I already know how to change the UINavigationBar for instance. But I'd also like to customize my buttons, my tab bar, menu bar, bar button items, and so on. Any good resources for this?
To be more specific, I'm more interested on HOW to do the customization on these elements, not so much as to look for good ideas on how to make them loon, though those are appreciated.
There are dozens of great UI designers around the internetz and a couple of them have great websites!
You can absolutely use them as reference and as inspiration. But you will need to do the work (coding + grafix) on your own.
Your question is a bit to wide ranged to answer it easily. (almost) Every UIKit control has different methods to manipulate its grafix/design. E.g. a UIButton is easy to customize by setting its button style to plain and set a custom Background Image, but that won't work for a UISlider.
Custom images are a popular method to implement a nice design as UI. It's pretty great to work with a good artist or do it yourself if you are experienced with design tools like photoshop and simply add the images of your design to your apps but never forget the weight of images.
Keep the file sizes in mind and don't let a simple app have more than a few mb. (Especially if you want to support retina devices)
In addition to that don't underestimate the power of core graphics. You can do a lot of fancy design stuff like nice gradients as backgrounds or shadow effects by code without the need of images.
Since iOS5 there is a protocol called UIAppearance. It helps a lot to implement custom UI designs but sadly it is not backwards compatible. Just take a look at my favorite tutorial site for iOS stuff about UI customization in iOS 5. Ray Wenderlich - User Interface Customization in iOS 5
And last but not least some common design websites for mobile UI:
dribble
creattica
tapfancy

How to create the controller and the UIView programmatically and not use the interface builder? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am trying to learn some of the basics about creating views and view controllers on iOS. All the samples and documentation I've come across use the Interface Builder and NIB files to create UIViewControllers and UIViews. How to create the controller and the UIView programmatically and not use the interface builder?
You may do that, that's for sure. But you should see the pros and cons here;
You create and manage everything in code, neat huh?
Well this means, you will retain/release everything yourself.
You will write lots of boilerplate code just to create a complex view with more than one layer of component hierarchy.
You will not see the properties you may change, instead you need to see the Class Reference document for each component.
You need to play with pixel values a lot, i cannot emphasize how long this "a lot" will eventually be.
So, consider Interface Builder, it is easier to keep everything seperate, and then bind them as needed. Code maintenance is much more important in the later phases, as the app becomes mature.
I have been through both ways, and my vote is +1 for Interface Builder, and override stuff only when needed. That is in practice less than like 5% of your UI development time.
The short answer is that yes, of course you can create views and view controllers programmatically.
As someone who had this same feeling when I first started out, let me impart this short bit of wisdom: Do not try and remove all .xib files from your project until you know a lot more about what you are doing!
There are tutorials out there on how to remove the .xib files entirely from your project, and remove dependency on MainWindow.xib. In my experience it is definitely not worth your time. Just leave the .xib files in your resources folder, close it up and pretend they don't exist.
Eventually, you may even be happy they are still there.
Yes,
You can create UIViewController and UIView programmatically,
See the Apple documentation for UIViewController and UIView, there are many function which start with init, used to create programmatically.
Suggest you to invest some time reading Documentation.

Resources