Do Not Think!!!

최근 사진

2011/12 시즌 2012년 2월 18-19일 용평리조트
2011/12 시즌 2012년 1월 27-28일 휘닉스파크
사무실 이사
2011/12시즌 2011년 12월 17일 휘닉스파크
2011/12시즌 2011년 12월 10일 휘닉스파크
2011/12시즌 2011년 12월 4일 휘닉스파크
2011/12시즌 2011년 11월 26일 휘닉스파크
2011년 8월 뉴질랜드 여행
2011년 5월 4일 ~ 7일 홍콩 워크샵 사람
2011년 5월 4일 ~ 7일 홍콩 워크샵 넷 째날

최근 트랙백

Total226673
Today2
Yesterday103
버튼을 이용해서 UIPickerView 또는 UIDatePicker 를 이용하는 방법은 여러가지가 있습니다.

그 중에서 버튼을 누르면 UITextField 처럼 하단에서 커스텀 키보드가 나오도록 하는 방법입니다.

UIButton 을 상속받아서 UIResponder 의 - (BOOL)canBecomeFirstResponder 를 구현합니다.


CustomButton.h
//
// CustomButton.h
//
// Created by Cho, Young-Un on 11. 9. 2..
// Copyright 2011 cultstory.com. All rights reserved.
//

#import <UIKit/UIKit.h>


@interface CustomButton : UIButton {
@private
UIView *_inputView;
}


@property (nonatomic, retain) UIView *inputView;

@end



CustomButton.m
//
// CustomButton.m
//
// Created by Cho, Young-Un on 11. 9. 2..
// Copyright 2011 cultstory.com. All rights reserved.
//

#import "CustomButton.h"


@implementation CustomButton

@synthesize inputView=_inputView;

- (void)dealloc {
[_inputView release];

[super dealloc];
}

- (BOOL)canBecomeFirstResponder {
return YES;
}

@end



사용법
UIPickerView *pickerView = [[[UIPickerView alloc] initWithFrame:CGRectMake(0, 10, 320, 216)] autorelease];
pickerView.delegate = self;
pickerView.dataSource = self;
pickerView.showsSelectionIndicator = YES;

CustomButton customButton = [[CustomButton alloc] initWithFrame:CGRectMake(10, 10, 300, 40)];
customButton.inputView = pickerView;

[button becomeFirstResponder];





크리에이티브 커먼즈 라이센스
Creative Commons License

Trackback Address :: http://dont.pe.kr/tt/trackback/386

Name

Password

Homepage

Secret

PREV 1 ... 14 15 16 17 18 19 20 21 22 ... 360 NEXT