English 中文(简体)
如何正确使用自己的键盘和外部外框键盘
原标题:how use own keyboard with uitextfields correctly

我想用自己的键盘类与文本字段。 我如何使用它简单而正确?

现在我有了这样的东西:

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:overlay];


CGRect lRect = CGRectMake(location.x, location.y, 1, 1);
if (CGRectIntersectsRect(lRect, self.tc.frame)) {
    textFieldID = self.tc.tag;
}

if (CGRectIntersectsRect(lRect, self.tm.frame)) {
    textFieldID = self.tm.tag;
}

if (CGRectIntersectsRect(lRect, self.tp.frame)) {
    textFieldID = self.tp.tag;
}
string = [NSMutableString stringWithString:@"0"];
}

但我的文本字段已禁用, 文本字段以上的 iview 位置会检测哪个文本字段被选中 。

-(UITextField *)initializeTextFieldWithFrame:(CGRect)frame andTag:(Byte)tag {
UITextField *tf = [[UITextField alloc] initWithFrame:frame];
[tf setBackgroundColor:[UIColor colorWithRed:52.0/255.0 green:114.0/255.0 blue:151.0/255.0 alpha:1.0]];
[tf setTextColor:[UIColor whiteColor]];
[tf setFont:[UIFont fontWithName:@"Helvetica" size:18.0]];
[tf setTextAlignment:UITextAlignmentCenter];
[tf setBorderStyle:UITextBorderStyleRoundedRect];
[tf setDelegate:self];  
[tf setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
[tf setEnabled:NO];
[tf setTag: tag];
[tf setText:@"0.0"];
[self insertSubview:tf atIndex:0];

return tf;
}

-(void)write:(id)sender {
....
}
最佳回答

在屏幕上的其他地方,没有使用自己的键盘作为标准键盘的方法。

问题回答

暂无回答




相关问题
keyboard hook in windows C++ or what?

I wish to build my own application which can send keyboard commands(messages) to the Windows OS. For example when I press the combination ctrl+shift+n, I wish to launch the notepad.exe . How can I ...

Detect if any key is pressed in C# (not A, B, but any)

[EDIT 3] I kind of "solved it" by at using the "strange" version. At least for the most important keys. It is suffient for my case, where I want to check that ALT and ALT+A are not ...

Solution for iPhone new file dialog keyboard

i want to let the user type in the name of a new file, so there are certain characters i want to prevent entry on. is there a special keyboard i can use or can i disable certain keys on the iphones ...

Search by using the keyboard in a list/grid - algorithm

I need to implement a custom search in a grid and I would like to find some user interface guidelines that explain the standard way to implement it. I mean this kind of search that is initiated by ...

热门标签