Not getting events from controls in the accessoryview in a UITableViewCell


i want have couple of controls on right side of cell. specifically, need uilabel , uibutton. when button touched, want update label.

if remove label , assign button accessoryview (cell.accessoryview = button), works , events.

if create uiview, assign accessoryview, , add label , button subviews of accessoryview, don't events button.

uifont *font = [uifont systemfontofsize:12];
uilabel *label = [[[uilabel alloc] init] autorelease];
label.text = @"some text";
label.frame = cgrectmake(210, 10, 70, 25);
label.textalignment = uitextalignmentright;
label.font = font;

[cell.accessoryview addsubview:label];

// add button
uibutton* accessorybutton = [uibutton buttonwithtype:uibuttontypecustom];
[accessorybutton addtarget:self action:mad:selector( touchedrow: ) forcontrolevents:uicontroleventtouchupinside];
[accessorybutton setframe:cgrectmake(281, 10, 30, 25)];
[accessorybutton setimage:[uiimage imagenamed:mad:"trackingdot.png"] forstate:uicontrolstatenormal];
[accessorybutton setuserinteractionenabled:yes];

[cell.accessoryview addsubview:accessorybutton];

tried enabling user interaction on both table row , accessoryview itself, no avail. tried assigning event handler accessoryview, rather button, itself. but, of course, uiview doesn't respond message.

begging suggestions. have been banging head on wall couple of days , can't seem past it. :confused:
 

got fixed

ok. i'm not sure why; if add subviews uitableviewcell itself, rather accessoryview of cell, works.

replaced

[cell.accessoryview addsubview:label];


[cell addsubview:label];

, working fine. can explicitly set location of label , button, still appears same either way. ignoring predefined subviews of uitableviewcell , making direct child of cell, itself.

still seems items ought in accessoryview. i'll take working on not working...;)

hope helps else...:d
 


Forums Macs Mac Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

Comments

Popular posts from this blog

Upgrade Eligibility?

need help with itunes 7.7

How to change Apple IDs on iPhones