Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a reference to the current window?

Tags:

iphone

Need a ref to the window in which a view is inside (no matter how deep inside). Usually there is only one window in an iPhone app. How would I access that the most easy way? Is there something cooler than getting the app delegate to access the window?

like image 836
dontWatchMyProfile Avatar asked Jan 29 '26 16:01

dontWatchMyProfile


2 Answers

To get a currently used window by your application use:

[[UIApplication sharedApplication] keyWindow]
like image 100
Cyprian Avatar answered Jan 31 '26 09:01

Cyprian


Well, UIView has the window property...

like image 28
kennytm Avatar answered Jan 31 '26 09:01

kennytm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!