Common custom control development set for iOS development series-custom drop-down list button control development

Source: Internet
Author: User

Common custom control development set for iOS development series-custom drop-down list button control development

In actual development, we need to use the drop-down list many times. Let's implement it below.
The whc_combox.h header file is as follows:

//// WHC_ComboBox.h // WHC_ComboBox /// Created by Wu haichao on 15/4/2. /// # import
  
   
@ Interface WHC_ComboBox: UIButton @ end
  

The WHC_ComboBox.m source file is as follows:

//// WHC_ComboBox.m // WHC_ComboBox /// Created by Wu haichao on 15/4/2. //// # import "WHC_ComboBox.h" # define KWHC_PADING (5.0) // picture margin @ implementation WHC_ComboBox // load xib-(void) awakeFromNib {self. layer. borderColor = [UIColor blackColor]. CGColor; self. layer. borderWidth = 0.5;} // process the title area-(CGRect) titleRectForContentRect :( CGRect) contentRect {contentRect. origin. x = 1.0; return contentRect;} // process icon area-(CGRect) Align :( CGRect) contentRect {CGRect rc = CGRectZero; CGFloat width = CGRectGetHeight (contentRect)-2.0 * KWHC_PADING; rc. origin. x = CGRectGetWidth (contentRect)-width-KWHC_PADING; rc. origin. y = KWHC_PADING; rc. size. width = width; rc. size. height = width; return rc;} @ end

Related Article

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.