简体   繁体   中英

How to detect whether personal wifi hotspot or recording is undergoing on iOS?

Since the red/blue glowing banner will block quite a lot of the interface. http://d.pr/SfgW

This gives you the height of the status bar:

CGFloat statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height;

With Personal Hotspot enabled, it returns 40, and returns 20 otherwise.

The statusbar height is 40 even when you have an active call by pressing the home button durring a phone call, therefore you can not determine whether or not the personal hotspot is on.

you can get text message if any device is connect to hotspot.

UIApplication *app = [UIApplication sharedApplication];
UILabel *subviews12 = [[app valueForKey:@"statusBar"] valueForKey:@"doubleHeightLabel"];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM