-1

I have an iOS app with an iOS 8 widget, I am trying to get the size of the frame which contains my widget (NOT the size of the device screen), is this possible?

I have tried the following, but it returns the frame size of the entire device screen which is not what I am looking for.

CGSize sz = [UIScreen mainScreen].bounds.size;

In essence, this is what I am looking for:

enter image description here

Supertecnoboff
  • 6,406
  • 11
  • 57
  • 98
  • "I am trying to get the size of the frame which contains my widget" But it is the widget that _sets_ the size of that frame, so how can you _not_ know what the size is? The width is the width of the screen (except for the margin insets, which you know about), and the height is determined by your internal layout constraints. – matt Apr 15 '15 at 06:10
  • @matt The reason I asked this question is that I am using a Github library called SCLAlertView, but in my iOS 8 widget, it does not appear in the middle of the screen. It is wrong because it is using the entire device screen size to figure our where it should be, however for a widget, you need to use the height of the widget and not the height of the screen to figure this out. So what I want to do is to pass in the height of the widget to it OR get the library to figure out the height of the widget itself. – Supertecnoboff Apr 15 '15 at 06:15

1 Answers1

0

Ok no matter, I managed to fix it myself in the end. I just passed in the height of my view in manually to the library I am using so that it works.

Basically I am using a library called SCLAlertView for a nice popup alert, and to get it to position correctly (vertically) I am now passing in the height of my view, if it is indeed a widget view.

Supertecnoboff
  • 6,406
  • 11
  • 57
  • 98