iOS Sina Weibo-1.1 Navigation bar search box

Source: Internet
Author: User

The Navigation bar search box is a UI control that is often used for non-use.

1. Requirements:

  • On the Discovery page, add a search box to the top navigation bar Navigationbar
  • The left with the magnifying glass icon
2. Ideas
  • Use Uisearchbar: Apple system comes with, simple and easy to use, but the style is inflexible can not be customized (here Uisearchbar background color is easy to confuse with the background color of the navigation bar), can not modify the width of the height, and the iOS6 and iOS7 will produce different styles.
  • Create with Uitextfield: Inherit or extend Uitextfield, set background and left-side icons
3. Implement
  • Create a custom class that inherits Uitextfield, which is named Uysearchbar
  • Overrides the initWithFrame method, which is used to initialize the search box's icon, background picture, icon and text symmetry, clear button display
  • Instantiate the Uysearchbar on the desired controller, assign its location dimension information, and add it to the Navigationitem Titleview

4. Set the search image to be stretched

iOS Sina Weibo-1.1 Navigation bar search box

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.