Development and use of widgets for IOS Development (on)

Source: Internet
Author: User
Tags notification center

after the release of the IOS8, Apple officially released, about the third-party development software can be integrated into the mobile phone Notification Center, for our development, is undoubtedly a very new thing, is not ready to quickly add their own app to add the function of the widget extension.
so I'll simply share my personal simple process on the steps needed to expand the widget's functionality. Do not look treatise. I will be divided into two times to outline the basic additions of widgets as well as the layout and data sharing sections separately.
first, in your own menu item in Xcode, add a new target for the current project. Then select the application Extension type selected today.
Next, you'll get a target in your project, named after yourself, and you'll see an extra target here:more than one set of folders, there will be todayviewcontroller files, there is a storyboard.
Click to view storyboard, an interface will appear:
This is the original multi-widget extension template that Apple generated for you, where you can make the content you want to display in the notification hub, and the xib of the root operation is the same as the operation step. Run up first, try the results command+r result
Well, the purpose of the temporary is to achieve, the effect has been shown.

when the build or run, choose the two different target, there will be something different?
Choose the Host program, the root of the usual, the program will immediately run to your device, you can freely debug the program, Debug ah and so on. However, when you select the extension, run, you will get an interfaceYou can select your host program here and click Run. At this point, you can debug the extension. Otherwise, the code inside the extension cannot be debugged.


The above is basically a very detailed introduction of the steps to add the widget, then this time, for the widget layout. because it is the extension of the Notification Center, in view of the user experience, so when the layout is recommended, to avoid the view you designed to occupy too large area, suitable for just fine. Otherwise, it may backfire, allowing the user to feel disgust at your extension.
Widget notification hubs extension, which is supported by third-party apps when iOS8.0 is released, so there are some things to keep in mind when it comes to widget layout.The layout of the control, if not autolayout to constrain the relative position of the control, it is simply the size of the extension view, run, the size of the view will not change, only the original size. So in the layout, after zooming in on the view, the layout sub-control, to AutoLayout to constrain the position of the control, there will be no view control does not display correctly.

Development and use of widgets for IOS Development (on)

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.