27

I am having some trouble with VoiceOver turned on starting in iOS 7. I did register an instance of UITableViewHeaderFooterView child class inside viewDidLoad but when I am dequeque-ing it with -[tableView dequeueReusableHeaderFooterViewWithIdentifier:] it is always returning nil object.

The issue started to appear on iOS 7.0. It was not there on the previous version and certainly it works fine if it runs perfectly without VoiceOver on both 6.0 and 7.0

I could just not having a custom header instead, or instantiate a new object when dequeueReusableHeaderFooterViewWithIdentifier: returns nil. But I was wondering whether there is a known issue regarding this.

Cheers,

Rpranata
  • 2,010
  • 18
  • 24
  • did you get any more info on this? for me, it's not returning nil ever, even the first time it hits dequeueReusableHeaderFooterViewWithIdentifier:, instead it returns the tableviewheader with frame (0,0,0,0) – ManicMonkOnMac Nov 01 '13 at 20:38
  • One of my colleague talked to an Apple Developer during one of the Tech Talks and they said that there might be some problem with that and they re looking into it :) In the end, when I did get nil, I just instantiate the view from the NIB and return that instead. – Rpranata Nov 22 '13 at 08:34
  • 1
    I think loading the nib yourself and returning the cell object is your best option. I just hit this today, and it looks like the header cell's init/initWithFrame is being called, which ignores the nib file. So, you end up with a cell that has none of its outlets connected. – Scott K. Dec 16 '13 at 22:53
  • @ScottK. That is interesting. Why would the framework call initWithFrame instead of initializing it from the nib – Rpranata Dec 18 '13 at 07:41
  • From the stack trace, it looks like something in the accessibility support is calling cell.view, which will use the default initializer for the registered class. That calls through to init, which calls initWithFrame. – Scott K. Dec 18 '13 at 17:49
  • @Rpranata Had u got any solution for this? – Mehul Mistri Feb 03 '14 at 11:23

1 Answers1

0

You can use below method to create custom UITableViewHeaderFooterView

(void)registerClass:(Class)aClass forHeaderFooterViewReuseIdentifier:(NSString *)identifier
dhh
  • 4,289
  • 8
  • 42
  • 59
paul
  • 137
  • 4