Introduction
While working at JoyTunes on the latest versions of our top-notch piano app, we've done a great deal of UI redesign and therefore had to spend long hours with the notorious Interface Builder, resizing images and views, which can be a lot of frustrating work.
While working at JoyTunes on the latest versions of our top-notch piano app, we've done a great deal of UI redesign and therefore had to spend long hours with the notorious Interface Builder, resizing images and views, which can be a lot of frustrating work.
During this work, we actually discovered a great deal of neat IB tricks, and I decided I must share them with the world.
So I conducted this little post of my 8 greatest tips for working effectively with IB.
A little disclaimer:
In JoyTunes, we work with .xib files (not storyboards), and without Auto Layout. This is mostly for historical reasons. As a result, some of the tips I'm mentioning might react a little differently for you if you're using storyboards or Auto Layout, but most should apply just the same.
1. Size to Fit Content
I'm so ashamed I only took the effort to look this up only recently. A HUGE time saver.
Select any view and then go to Editor->Size to Fit Content or simply press ⌘=
Will resize the selected view to fit its content in the following manner:
- An ImageView/Button will be resized to the image's original size (most common usage):
- A Label/Button will be resized to fit the text it's currently containing:
- A parent container view to fit the frames of its subviews.
2. Holding option key to view distance from another view's edges
Holding option key after selecting a view, and then hovering over some other view, will show you cool distance indicators from that view's edges:
3. Editor -> Embed In View, Unembed:
Do you know that annoying feeling when you have some subviews all located and then you decide they need to have a different parent view, or even a different .xib, and then they are all automatically get located in the center of the new view?
Well - here's the solution:
4. Adding padding to freeform sized view without affecting subview's positions
When trying to add padding to a view, the x's and y's of the subview is retained, which isn't always what you want.
The best way I found to get past this, is to drag the edges while holding ⌘:
When trying to add padding to a view, the x's and y's of the subview is retained, which isn't always what you want.
The best way I found to get past this, is to drag the edges while holding ⌘:
5. Move a view that isn't in the front:
One thing that bugs me when working with IB, is the inability to move views that aren't in front easily.
One way to do so will be to temporary bring it to front and then bring it back, but this is annoying.
Another way will be to use the size inspector on the right panel, which is fine but could take some guessing and adjustments until you get it right.
A way I found of moving a view with the arrow keys without bringing it to front is this:
1. Choose the view on the document outline.
2. Click on the frame of the root view in order to gain focus.
3. Move with arrow keys.
EDIT:
Some other (better) way of gaining focus, taken from the comments to this post:
One thing that bugs me when working with IB, is the inability to move views that aren't in front easily.
One way to do so will be to temporary bring it to front and then bring it back, but this is annoying.
Another way will be to use the size inspector on the right panel, which is fine but could take some guessing and adjustments until you get it right.
A way I found of moving a view with the arrow keys without bringing it to front is this:
1. Choose the view on the document outline.
2. Click on the frame of the root view in order to gain focus.
3. Move with arrow keys.
EDIT:
Some other (better) way of gaining focus, taken from the comments to this post:
- If you double-click a view in the outline, it will switch focus to the layout pane with that view selected.
- Shift+Right(Ctrl) Click over the view in IB and you'll see a menu of all the views that exist where you've clicked.
6. IBOutletCollection ordering
Often, the order of IBOutletColletions is important to us, and we want to iterate on them in code in that order.
One way of doing it is sorting them in code by their x/y/tag, and then iterate.
This is unnecessary. The order of connection is determined by the order in which we dragged the connection, and we can see the current order if by ⌃+Clicking the File's Owner:
7. Use custom properties
I think a relatively underused feature of IB is the ability to set custom properties on views, using the "User Defined Runtime Attributes" of the Identity inspector:
As you can probably guess, we defined a JTLabel class that you can set stroke color and width to, and this is our way of immediately setting this without having to write any code.
Another common hack that can be applied this way is setting "layer.cornerRadius" of any view, to make it have rounded corners.
A relevant tool that uses this mechanism is Canvas, which will let you define animations for views without writing code.
Important warning regarding this that saved my life on one occasion:
One way of doing it is sorting them in code by their x/y/tag, and then iterate.
This is unnecessary. The order of connection is determined by the order in which we dragged the connection, and we can see the current order if by ⌃+Clicking the File's Owner:
7. Use custom properties
I think a relatively underused feature of IB is the ability to set custom properties on views, using the "User Defined Runtime Attributes" of the Identity inspector:
As you can probably guess, we defined a JTLabel class that you can set stroke color and width to, and this is our way of immediately setting this without having to write any code.
Another common hack that can be applied this way is setting "layer.cornerRadius" of any view, to make it have rounded corners.
A relevant tool that uses this mechanism is Canvas, which will let you define animations for views without writing code.
Important warning regarding this that saved my life on one occasion:
In your implementation class you cannot use initWithCoder: otherwise your key-value path setting will not be picked up. You will have to do all your implementation within awakeFromNib.
(Credit to http://www.wannabegeek.com/?p=395)
8. MoarFonts - custom fonts WYSIWYG
Custom fonts have always been a big issue when working with Interface Builder.
There's no built-in support for those, and the best solutions I have seen were either using custom properties solutions like Canvas, or using font replacing techniques like IBCustomFonts. These are valid solutions, but they have a great downside - they don't give you a full WYSIWYG experience, which is exactly why you are using Interface Builder in the first place.
It can be very annoying to place a label with a placeholder font and then having to run the app in order to discover that the width you gave it doesn't fit well with your replacing custom font.
Lately I stumbled upon this solution called MoarFonts. It costs 10$, and there's no demo or trial - but trust me, it's totally worth it!
It's a pretty simple setup: you'll have to build your app with MoarFonts as a script build phase, restart Xcode, and voila! You can see custom fonts in InterfaceBuilder:
That's it!
I hope at least some of the tips were something you didn't know.
If you have any other tips you think I should add to the list, or if you have a better way to achieve some of the stuff I was trying to solve, please send me a tweet (@theyonibomber).
Also, you should listen to my podcast about mobile development & beer (in Hebrew).
Very cool post, other than one tip, i don't know anything until now. Thank you very much!
ReplyDeleteIEEE Final Year projects Project Centers in India are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation. For experts, it's an alternate ball game through and through. Smaller than expected IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble. Final Year Projects for CSE It gives you tips and rules that is progressively critical to consider while choosing any final year project point.
DeleteJavaScript Online Training in India
JavaScript Training in India
The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training
Thanks for sharing such a Post!
DeletePython Course in Bangalore
React Course in Bangalore
Automation Anywhere Course in Bangalore
Blue Prism Course in Bangalore
RPA Course in Bangalore
UI Path Course in Bangalore
Clinical SAS Course in Bangalore
Oracle DBA Course in Bangalore
iOS Course in Bangalore
SolidWorks Course in Bangalore
neat tricks, thanks!
ReplyDeleteGood tips. Another tip useful for #5: If you double-click a view in the outline, it will switch focus to the layout pane with that view selected.
ReplyDeleteThanks! Edited the tip.
DeleteFantastic tips!
ReplyDeleteThere is a better way to achieve #5 though - Shift+Right(Ctrl) Click over the view in IB and you'll see a menu of all the views that exist where you've clicked. Select the one you want from the list, and you can then use the arrow keys to move it.
Thanks! It does seem like a better way. Edited the tip.
DeleteThank you! I don't know IBOutletColletions before reading this post.
ReplyDeleteThank you for the great tips...!!!
ReplyDeleteThank's - love #1 :-)
ReplyDeleteI wish I stumbled on to your #3 point "Embed in View > Unembed" a while back. It was a pain to get all those elements back in their position across 5 different views. Most of these are fantastic tips and shown with a nicer gif than a simple screenshot. Kudos!
ReplyDeleteThank you for the great post, it's very useful!!
ReplyDeleteHave noticed an anoying thing. When draging out a new image from bottom right collection of assets, the size of the UIImageView gets doubled. I have to manually resize every image I drag in.
ReplyDeletemy mind is good now
ReplyDeleteGood tips. We need more posts like this to know about the "tricks" there is from Xcode IB.
ReplyDeleteVIRUS REMOVAL
ReplyDeleteIs Your Computer Sluggish or Plagued With a Virus? – If So you Need Online Tech Repairs
As a leader in online computer repair, Online Tech Repairs Inc has the experience to deliver professional system optimization and virus removal.Headquartered in Great Neck, New York our certified technicians have been providing online computer repair and virus removal for customers around the world since 2004.
Our three step system is easy to use; and provides you a safe, unobtrusive, and cost effective alternative to your computer service needs. By using state-of-the-art technology our computer experts can diagnose, and repair your computer system through the internet, no matter where you are.
Our technician will guide you through the installation of Online Tech Repair Inc secure software. This software allows your dedicated computer expert to see and operate your computer just as if he was in the room with you. That means you don't have to unplug everything and bring it to our shop, or have a stranger tramping through your home.
From our remote location the Online Tech Repairs.com expert can handle any computer issue you want addressed, like:
• - System Optimization
• - How it works Software Installations or Upgrades
• - How it works Virus Removal
• - How it works Home Network Set-ups
Just to name a few.
If you are unsure of what the problem may be, that is okay. We can run a complete diagnostic on your system and fix the problems we encounter. When we are done our software is removed; leaving you with a safe, secure and properly functioning system. The whole process usually takes less than an hour. You probably couldn't even get your computer to your local repair shop that fast!
Call us now for a FREE COMPUTER DIAGONISTIC using DISCOUNT CODE (otr214427@gmail.com) on +1-914-613-3786 or chat with us on www.onlinetechrepairs.com.
1 Problem: HP Printer not connecting to my laptop.
ReplyDeleteI had an issue while connecting my 2 year old HP printer to my brother's laptop that I had borrowed for starting my own business. I used a quick google search to fix the problem but that did not help me.
I then decided to get professional help to solve my problem. After having received many quotations from various companies, i decided to go ahead with Online Tech Repair (www.onlinetechrepairs.com).
Reasons I chose them over the others:
1) They were extremely friendly and patient with me during my initial discussions and responded promptly to my request.
2) Their prices were extremely reasonable.
3) They were ready and willing to walk me through the entire process step by step and were on call with me till i got it fixed.
How did they do it
1) They first asked me to state my problem clearly and asked me a few questions. This was done to detect any physical connectivity issues with the printer.
2) After having answered this, they confirmed that the printer and the laptop were functioning correctly.
3) They then, asked me if they could access my laptop remotely to troubleshoot the problem and fix it. I agreed.
4) One of the tech support executives accessed my laptop and started troubleshooting.
5) I sat back and watched as the tech support executive was navigating my laptop to spot the issue. The issue was fixed.
6) I was told that it was due to an older version of the driver that had been installed.
My Experience
I loved the entire friendly conversation that took place with them. They understood my needs clearly and acted upon the solution immediately. Being a technical noob, i sometimes find it difficult to communicate with tech support teams. It was a very different experience with the guys at Online Tech Repairs. You can check out their website www.onlinetechrepairs.com or call them on 1-914-613-3786.
Would definitely recommend this service to anyone who needs help fixing their computers.
Thanks a ton guys. Great Job....!!
These are some helpful home improvement & computer tips. Thanks for the share!
ReplyDeletei really like this News, looks great
ReplyDelete=Daily Newspapers
Online newspapers | Clippingpathaster
Free Movie | Watch
HD MOVIE | Animals News Online Dating
Nice post!! Thanks for sharing.
ReplyDeleteDermology anti aging Serum
dermology anti aging cream
dermology anti aging cream
Dermology
Xtreme No
Xtremeno
hgh energizer
Laptop & Desktop repair services are now available @1-855-837-9965. No-Fix No-Fee, Cost effective Repairs and upgrades on all brands of PC's and Laptops.
ReplyDeleteThis post is very informative for everybody. I would like to appreciate your work for good accuracy and got informative knowledge from here. Nice effort, very informative, this will help me to complete my task. Thanks for sharing
ReplyDeleteOracle Fusion HCM Technical Training
Nice post!! Thanks for sharing.
ReplyDeletedermology hair removal cream
Nice post!! Thanks for sharing on XTremeNO
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis blog explains the details of most popular technological details. This helps to learn about what are all the different method is there. And the working methods all of that are explained here. Informative blog.For more info visit our website.
ReplyDeleteFusion Cloud SCM Course Structure
Thank you for sharing such a valuable article with good information containing in this blog.learn Oracle Fusion Technical Online Training.
ReplyDeleteOracle Fusion Technical Online Training
Thanks for sharing valuable information in the article.students can make a good career by learning Oracle Fusion SCM Online Training.
ReplyDeleteOracle Fusion SCM Online Training
Thanks for providing such a great information in the blog and also very helpful to all.learn best Oracle Fusion HCM Online Training.
ReplyDeleteOracle Fusion HCM Online Training
Really very helpful article , Thank you for sharing
ReplyDeleteOracle Fusion Financials Online Training
Hey Really Thanks for sharing the best information regarding oracle,hope you will write more great blogs.
ReplyDeleteOracle Fusion HCM Online Training
Very interesting blog Awesome post. your article is really informative and helpful for me and other bloggers too
ReplyDeleteOracle Fusion SCM Training In Hyderabad
Thank you for providing useful information and this is the best article blog for the students.learn Oracle Fusion Technical Online Training.
ReplyDeleteOracle Fusion Technical Online Training
Thank you for sharing such a valuable article with good information containing in this blog.learn Oracle Fusion SCM Online Training.
ReplyDeleteOracle Fusion SCM Online Training
Thanks for sharing valuable information in the article.students can make a good career by learning HR Training In Hyderabad
ReplyDeleteHR Training In Hyderabad
Thanks for providing such a great information in the blog and also very helpful to all.learn best Core HR Training Hyderabad
ReplyDeleteCore HR Training Hyderabad
Thanks for providing such a great information in the blog and also very helpful to all the students.
ReplyDeleteOracle Fusion HCM Online Training
Such a nice blog, I really like what you write in this blog, I also have some relevant Information about if you want more information.
ReplyDeleteOracle Fusion HCM Online Training
Thank you for sharing such a nice and interesting blog.
ReplyDeleteOracle Fusion SCM Online Training
Very interesting blog Really excellent information and thank you for giving your valuable information
ReplyDeleteOracle Fusion SCM Online Training
https://g.co/kgs/GGvnG8
Deletehttps://bateraitanam.blogspot.com
https://bimbellampung.blogspot.com
lampungservice.com
An astounding web diary I visit this blog, it's inconceivably magnificent. Strangely, in this current blog's substance made point of fact and sensible. The substance of information is instructive.
ReplyDeleteOracle Fusion Financials Online Training
Oracle Fusion HCM Online Training
Oracle Fusion SCM Online Training
An astounding web diary I visit this blog, it's inconceivably magnificent. Strangely, in this current blog's substance made point of fact and sensible. The substance of information is instructive.
ReplyDeleteOracle Fusion Financials Online Training
Oracle Fusion HCM Online Training
Oracle Fusion SCM Online Training
A befuddling web diary I visit this blog, it's incredibly grand. Strangely, in this present blog's substance made motivation behind fact and sensible. The substance of information is instructive
ReplyDeleteOracle Fusion Financials Online Training
Oracle Fusion HCM Online Training
Oracle Fusion SCM Online Training
An overwhelming web journal I visit this blog, it's unfathomably amazing. Unusually, in this present blog's substance made inspiration driving truth and reasonable. The substance of data is enlightening
ReplyDeleteOracle Fusion Financials Online Training
Oracle Fusion HCM Online Training
Oracle Fusion SCM Online Training
Thank you For Sharing Useful information HR Edge Practical Training Program in Hyderabad
ReplyDeleteAn overwhelming web journal I visit this blog, it's unfathomably amazing. Unusually, in this present blog's substance made inspiration driving truth and reasonable. The substance of data is enlightening
ReplyDeleteOracle Fusion Financials Online Training
Oracle Fusion HCM Online Training
Oracle Fusion SCM Online Training
Quickbooks Accounting Software
ReplyDeleteAn overwhelming web journal I visit this blog, it's unfathomably amazing. Unusually, in this present blog's substance made inspiration driving truth and reasonable. The substance of data is enlightening
ReplyDeleteOracle Fusion Financials Online Training
Oracle Fusion HCM Online Training
Oracle Fusion SCM Online Training
I really enjoyed your blog Thanks for sharing such an informative post.
ReplyDeletehttps://myseokhazana.com/
https://seosagar.in/
Indian Bookmarking list
Indian Bookmarking list
India Classified Submission List
Indian Classified List
Indian Bookmarking list
Indian Bookmarking list
India Classified Submission List
Indian Classified List
Thanks for sharing the informative post.
ReplyDeleteRepair Shop POS
Thank you for sharing such a nice and interesting blog with us. I have seen that all will say the same thing repeatedly. But in your blog, I had a chance to get some useful and unique information.
ReplyDeleteDigital Marketing Training In Hyderabad
sem training in hyderabad
seo training in hyderabad
SMM Training In Hyderabad
smart outsourcing solutions is the best outsourcing training
ReplyDeletein Dhaka, if you start outsourcing please
visit us: outsourcing training in dhaka
Nice Blog with Good Information
ReplyDeleteSoft Online gives best training for Oracle Fusion and EBS Courses
Oracle Fusion SCM Training
Oracle Fusion HCM Training
Oracle Fusion Financials Training
For more info Visit us: www.softonlinetraining.com
Really thanks for sharing this useful blog !! This post is very informative about tips for working with interface builders . keep sharing !!
ReplyDeleteThanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
ReplyDeleteworkday studio online training
best workday studio online training
top workday studio online training
ReplyDeleteThanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
blockchain online training
best blockchain online training
top blockchain online training
Thank you for the helpful post, it's very informative!!
ReplyDeleteCloud accounting software
Contractor accounting
how to file company accounts
I am offering you the best SEO backlinks offer to rank your website on google 1st page.
ReplyDeleteTo increase your site's ranking, you must need high-quality Dofollow backlinks .
My all backlink will mix in do-follow and no-follow ( Google says in February 2020) they
count no-follow backlink for ranking)
Living in the tech era, every computer repair business needs to systemize its business operations to provide a better solution to the clients by using Computer Repair Shop Software , It enables management to deal with routine business operations swiftly and keep working on increasing business productivity.
ReplyDeleteThis is very good post I have read and I must appreciate you to have written this for us.Its really informative.
ReplyDeleteGreat article with excellent idea i appreciate your post thankyou so much and let keep on sharing your stuffs
Thanks for the article…
Best Digital Marketing Agency in Chennai
Best SEO Services in Chennai
seo specialist companies in chennai
Brand makers in chennai
Expert logo designers of chennai
Best seo analytics in chennai
leading digital marketing agencies in chennai
Best SEO Services in Chennai
Website design and digital marketing company varanasi India
ReplyDeleteWebsite designing In varanasi India
E-commerce website development company varanasi India
Search engine optimization company varanasi India (seo)
Website designing india
Best Digital Marketing Company India
top 10 website designing company India
Shopping website development company In Varanasi India
Digital Marketing company In Varanasi
Best website designing company varanasi
Data analytics company India
wordpress website maintenance company varanasi india
Wordpress development company Varanasi India
Website maintenance company varanasi India
Aivivu - đại lý chuyên vé máy bay trong nước và quốc tế
ReplyDeletevé máy bay từ hàn quốc về việt nam bao nhiêu tiền
mua vé máy bay đà nẵng sài gòn
đặt vé máy bay từ huế đi hà nội
vé máy bay đi Huế pacific airline
vé máy bay từ tphcm đi quy nhơn
This comment has been removed by the author.
ReplyDeletewordpress design agency in united states Need professional WordPress Web Design Services? We're experts in developing attractive mobile-friendly WordPress websites for businesses. Contact us today!
ReplyDelete