XIB, storyboard operation skill Sorting collection

Source: Internet
Author: User

Transfer from http://my.oschina.net/joanfen/blog/314763

Hide tab when SB push tab

I believe there are a lot of people like me, started to use tabBar when the distress over the built-in tabBar viewControllers added navigationController problems

Apple wants us to use it tabBar as a root view, of course, if you stubbornly make it as a navigationcontroller rootViewController can also be run successfully and achieve their own purposes, but like a time bomb, there will be an inexplicable program run is a crash problem, Waiting for the problem to change the initial view frame is a very painful thing, do not ask me how to know, I just want to say, please do not ignore Apple to give you the hint. Even if you can achieve the desired effect.

So, to use the navigationController push view, you can only TabBar viewControllers set the view controller that you want to do push , and you can do it with the navigationController direct push action tabBar .

How to Solve

    1. Storyboard: In the general settings of the Viewcontroller you want to push, Hide Bottom Bar on Push will be checked on
    2. Code:
      self.hidesBottomBarWhenPushed = YES;

PS: In Extend Edges the Under Top Bars properties in your view from NV push come over when there is a distance of the blank, this option is checked to remove the general can be resolved

Set rounded corners

We all love round corner, button, pop-up view, etc., do not add fillet how to look like Demo there is wood, but every time to write that a few lines of code is really enough, of course, can also be encapsulated after the call, this is one, but in the debugging program to see the effect as soon as possible, can be directly in the Xib and XB view

Select View, select the Class option on the right side of the work bar, User Defined Runtime Attributes add the properties you want to add to the view in the zone, and you can see that there are many kinds of type options, so, but whatever property is in type can be set in this way, layer边框颜色 or it can be set directly, Without having to tangle with RGB values and so on, you can take the color directly, here the relevant tips I do not list,

The individual view of SB

Many people think that storyboard the individual view is removed, so that in the VC want to add a separate view, always to create a separate xib, or code writing.

In fact, add the view view in the SB VC, after the layout is finished, drag it to a side First Responder Exit position, you can also create a map, add response events for the control, and so on, equivalent to the individual views in the previous xib, but can not visually see the layout of these views, such as to view the layout state, You have to drag it to the main window of Viewcontroller to view it.

Visual coordinate distance

The most annoying problem with IB is alignment. We can explicitly specify X, y coordinates when using the code, but when we switch to IB we are more often uiview by dragging and dropping. For example, need three of the same label, in addition to the powerful naked eye to estimate whether the distance is equal, you can only obediently select three labels, write down their coordinates and then open the calculator to do add and subtract?

Obviously not so stupid. Select a label, and then hold down the option key and move the mouse over the other label to try it? You can see that the distance between the view is displayed in a very easy-to-understand way. Not only the same level of view, but also the distance between the selected view and other levels of view can be displayed as well.

After selection, the effect is similar to the example diagram for adding guides below

Merging multiple view views into one view level

Sometimes more than one control is added, and the hardships finally adjust the alignment, spacing

Found to put these controls in a parent Class view for ease of operation, the most intuitive, drag a view to the panel, select these controls, dragged to this view , the tragedy happened, can only open the eyes again, one alignment, adjust it

Obviously no, check these controls, select the menu barEditor->Embed in->View/Scroll view

The final control is still rehearsed in the original style on a view

Similarly, to move it from the parent Class View to another view, select Editor->Unembed it.

Add guides to a view

The design is generally aware of how important the guides are, and we can add guides to the view when we are laying out the view, making it easier for us to layout more accurately

添加: Double-click a view, press shift + Command + - Add horizontal guides, shift + Command + | Add vertical guides, add positions 左右/上下 centered

移动: A draggable button appears when you move the cursor to the line, drag 左右/上下 to the desired position, and drag to see the distance of the secondary line from the view/up/down

删除: The way is very simple, as with the way to delete breakpoints, quickly drag to the point where the view is not visible can be deleted

XIB, storyboard operation skill Sorting collection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.