How you have add button on cell I am putting one sample in (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath UIButton *btnDetail = UIButton buttonWithType:UIButtonTypeRoundedRect ; btnDetail setFrame:CGRectMake(225.0f, 15.0f, 65.0f, 20.0f) ; //btnDetail. BackgroundColor = UIColor grayColor; btnDetail setTitle:@"Detail" forState:UIControlStateNormal; btnDetail setTitleColor: UIColor redColor forState: UIControlStateNormal; btnDetail. TitleLabel setFont:UIFont fontWithName:@"Verdana-Bold" size:12; btnDetail setBackgroundColor:UIColor clearColor; btnDetail sizeThatFits:btnDetail.frame.
Size; cell addSubview:btnDetail; btnDetail addTarget:self action:@selector(function1:) forControlEvents:UIControlEventTouchUpInside; btnDetail setImage:UIImage imageNamed:@"btn-detail. Png" forState:UIControlStateNormal if you have written btnDetail addTarget:self action:@selector(function1:) forControlEvents:UIControlEventTouchUpInside your button should able to capture touch event and function1 should be called... on it's touch event.
How you have add button on cell I am putting one sample in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath ... UIButton *btnDetail = UIButton buttonWithType:UIButtonTypeRoundedRect ; btnDetail setFrame:CGRectMake(225.0f, 15.0f, 65.0f, 20.0f) ; //btnDetail. BackgroundColor = UIColor grayColor; btnDetail setTitle:@"Detail" forState:UIControlStateNormal; btnDetail setTitleColor: UIColor redColor forState: UIControlStateNormal; btnDetail. TitleLabel setFont:UIFont fontWithName:@"Verdana-Bold" size:12; btnDetail setBackgroundColor:UIColor clearColor; btnDetail sizeThatFits:btnDetail.frame.
Size; cell addSubview:btnDetail; btnDetail addTarget:self action:@selector(function1:) forControlEvents:UIControlEventTouchUpInside; btnDetail setImage:UIImage imageNamed:@"btn-detail. Png" forState:UIControlStateNormal; if you have written btnDetail addTarget:self action:@selector(function1:) forControlEvents:UIControlEventTouchUpInside; your button should able to capture touch event and function1 should be called... on it's touch event...
This is the method I am using. However, the didSelectRowAtIndexpath is getting the touch and not the UIControlEventTouchDownInside. The size of the button is 16x16 (the size of its background image) but I don't think making it larger is going to do anything.
– Michael Morrison Apr 17 '10 at 5:31 try UIControlEventTouchUpInside then.... – mihir mehta Apr 17 '10 at 5:49 Nope. Anything else? Have you tried this yourself?
– Michael Morrison Apr 17 '10 at 5:56 I have written above code on cellForRowAtIndexPath and button is perfectly receiving touch event.... for time being increase button size for making sure that you're clicking inside of button only.. – mihir mehta Apr 17 '10 at 5:59 I must apologize. You are indeed correct. Your method works fine.
I had other errors preventing the implementation. Thanks for explaining and commenting. – Michael Morrison Apr 17 '10 at 6:46.
I tested the "delayTouchesBegan" method with double taps but I found that the single tap received by the table is then delayed, making the table interaction less responsive to the user, and perhaps annoying. My solution is a bit pedestrian but I use a timer to detect taps in method didSelectRowAtIndexPath. I record the tap count of "1" for the first tap, and if the user does not tap again with 0.2 seconds it displays the item selected.
If the user tapped within 0.2 seconds for tap count "2" then I display another item (an action sheet).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.