iOS Today Extension Table View Rows only detects taps on a label

后端 未结 4 1553
天涯浪人
天涯浪人 2020-12-19 08:48

I am having the weirdest of problems with a today widget on iOS.

I have a simple widget with a table view like this: https://grab.edr.io/2e557aa43a34b7460b1eac44cbca

相关标签:
4条回答
  • 2020-12-19 09:01

    Workaround: set the opacity(0.01) like this self.view.backgroundColor = [UIColor colorWithWhite:1 alpha:0.01];

    0 讨论(0)
  • 2020-12-19 09:15

    Got an answer back from Apple's Developer Support.

    It's an iOS 8 bug.

    A workaround for it is to set the opacity of the widget to 0.01.

    0 讨论(0)
  • 2020-12-19 09:17

    Using the workaround of a background view with a white background color and alpha of 0.01 causes a slightly visible border on iPads where the notification center doesn't cover the whole screen, especially on the right edge of the table view.

    Another workaround without this visual glitch is to use a UILabel as the cell's backgroundView. The label needs no text or background color.

    self.backgroundView = [UILabel new];
    
    0 讨论(0)
  • 2020-12-19 09:21

    Swift 2.1 / iOS 9.1 solution:

    self.view.backgroundColor = UIColor(red: (255.0/255.0), green: (255.0/255.0), blue: (255.0/255.0), alpha: 0.01)
    
    0 讨论(0)
提交回复
热议问题