iphone开发之自定义下拉列表UIcombobox控件

本文介绍了如何在iPhone开发中创建自定义的下拉列表UIComboBox控件,提供了一段实现该功能的代码,适用于需要下拉列表功能的场景。
摘要由CSDN通过智能技术生成

很多时候我们都会用到下拉列表框,闲着没事自己实现了一个共享之。

代码如下:

//
//  CLOCombobox.h
//  CLOComboboxText
//
//  Created by Cloay on 12-8-9.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface CLOCombobox : UIView<UITableViewDelegate, UITableViewDataSource>{
    NSArray *array;
    UITextField *textField;
    UITableView *comboboxItems;
}
- (id)initWithFrame:(CGRect)frame withItems:(NSArray *)items withSuperView:(UIView *)view;
@end

实现如下:

//
//  CLOCombobox.m
//  CLOComboboxText
//
//  Created by Cloay on 12-8-9.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "CLOCombobox.h"

#define itemHeight 35
#define tableviewHeight 180
@implementation CLOCombobox

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
     
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值