0

I have this code:

UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *imgIcon = imageNamed(@"icon_1.png");
[btn1 setImage:imgIcon forState:UIControlStateNormal];

CGPointMake(textField.frame.size.width+textField.frame.origin.x+btnTalk.frame.size.width/2, textField.frame.origin.y+textField.frame.size.height/2);
[btnTalk addTarget:textField action:@selector(Hello:) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:btnTalk];

i can tap in UIbutton and it works but i want to call with other button i want create one IBAction for call this UIButton

i writes this code but doesn't work & textfield is (objectOfAnotherClass)

-(IBAction)call1
{
    [textField Hello];
}
4

2 回答 2

0

我认为你应该这样做:

[btnTalk addTarget:self action:@selector(Hello:) forControlEvents:UIControlEventTouchUpInside];

-(IBAction)call1
{
   [self Hello:nil];
}
于 2013-10-22T16:42:04.773 回答
0

我认为您正在寻找sendActionsForControlEvents可以帮助您“模拟”触摸按钮的动作...这里是方法描述。

于 2013-10-22T16:18:36.617 回答