An IBDesignable custom combobox control for iOS. The text font can resize adaptively.
From CocoaPods
pod 'THComboBox'
Attention:IBDesignable doesn't work with static libraries in Xcode now. Probably you'll meet this problem. Maybe this bug will be fixed in the future. But now you'd better install it from source.
- Drag the
THComboBox/
folder to your project #import "THComboBox.h"
Create a UIView
and change its class to THComboBox
Open the Attribute Inspector, and customize the properties:
Give the listItems and set the delegate:
self.comboBox1.listItems = @[@"主楼",@"学堂",@"文图",@"东门"];
self.delegate = self; //let the viewcontroller implement ComboBoxDelegate
Very easy like this:
THComboBox *comboBox2 = [[THComboBox alloc] initWithFrame:CGRectMake(200, 400, 210, 60)];
self.comboBox2.listItems = @[@"ob-c",@"java",@"c#",@"c++"];
self.delegate = self; //let the viewcontroller implement ComboBoxDelegate
Then change the settings programmatically.