के अंदर गायब हो जाता है मेरे पास एक टेबल है, मेरे पास cellForRowAtIndexPath प्रतिनिधि है और मेरे पास उस विधि के अंदर UITableViewCell बनाया गया है, जो मैं लौटाता हूं। CellForRowAtIndexPath में कहीं भी मैं उस सेल के सेल.contentView को UIButton जोड़ता हूं। यह सब ठीक काम करता है, जब तक कि मैं उस सेल को उस बटन के साथ नहीं चुनता। सेल नीले रंग में रंग बदलता है (जो ठीक है), यूबूटटन भी इसका रंग नीले रंग में बदल देता है। अब, अगर मैं चयनित सेल के अंदर उस UIButton पर क्लिक करता हूं, तो यह गायब हो जाता है! वाह, यह अजीब है, मैं इसे कैसे ठीक कर सकता हूं? मैं चयनित सेल के अंदर UIButton चाहता हूं, जब मैं इसे क्लिक करता हूं।चयनित UIButton चयनित UITableViewCell
संपादित करें: शामिल मेरी cellForRowAtIndexPath कार्यान्वयन
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *sectionsTableIdentifier = @" sectionsTableIdentifier ";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: sectionsTableIdentifier];
for (UIView *view in cell.contentView.subviews)
[view removeFromSuperview];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero
reuseIdentifier: sectionsTableIdentifier] autorelease];
}
CGRect newIconRect = CGRectMake(276, 40, 29, 29);
UIButton *newIcon = [[UIButton alloc] initWithFrame:newIconRect];
[newIcon setImage:[UIImage imageNamed:@"mynewicon.png"] forState:UIControlStateNormal];
[cell.contentView addSubview:newIcon];
[newIcon release];
return cell;
}
क्या हम आपके 'cellForRowAtIndexPath' विधि की सामग्री देख सकते हैं? 'tableView: didSelectRowAtIndexPath: यदि आप इसे लागू कर चुके हैं तो भी सहायक होगा। – Tim
हां, मैंने इसे संपादित में शामिल किया है, और मैंने नहीं किया है सिलेक्टरोएट इंडेक्सपैथ लागू किया गया है, केवल सेलफॉररोएट इंडेक्सपैथ – Mike
जब आप कहते हैं कि बटन "गायब हो जाता है", क्या यह छिपा हुआ है, या क्या यह वास्तव में अस्तित्व में है? क्या बटन के क्लिक हैंडलर को कॉल किया जाता है यदि आप उस क्षेत्र को दबाते हैं जहां यह होना चाहिए? –