_UIInteractiveHighlightEffectWindow's isHidden property default is YES? - ios

I got a window from the code below in iOS11:
UIWindow *window = [UIApplication sharedApplication].windows.lastObject;
its infomations were printed on console is like this:
<_UIInteractiveHighlightEffectWindow: 0x7fdfe84b88e0; frame = (0 0; 375 812); hidden = YES; opaque = NO; userInteractionEnabled = NO; gestureRecognizers = ; layer = >
what's confused me is its isHidden property default value is YES, why ? I tried to search some more infomation about it with key word "_UIInteractiveHighlightEffectWindow", l got nothing but it's a new property in iOS11. Apple also gives nothing about it .
Any one know something about it ? Any help is appreciated ! thanks !

Yes, "_UIInteractiveHighlightEffectWindow" is new on iOS, and there isn't much information about it currently.
However, if the topmost layers is need, use [UIApplication sharedApplication].keyWindow instead of [UIApplication sharedApplication].windows.lastObject, that would probably solve the problem.
I found some good explanation here:
diffrence between [[[[UIApplication sharedApplication] delegate] window] and [[UIApplication sharedApplication].keyWindow?

Related

Hiding iOS Status Bar's Text

This question is not about hiding the status bar, but merely hiding the text of the status bar.
I could nt find it anywhere to approach this problem
UBER app does this, when we open the side menu in uber, the status bar text disappear,
No you can't hide text of status bar. you can hide status bar with animation something like,
CGRect appFrame = [[UIScreen mainScreen] applicationFrame];
[UIView animateWithDuration:0.7 animations:^{
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
// self.navigationController.navigationBar.frame = self.navigationController.navigationBar.bounds;
self.view.window.frame = CGRectMake(0, 0, appFrame.size.width, appFrame.size.height);
}];
It is in obj c and just for understand concepts, convert in swift!
You can add new view instead of status bar as custom status bar look
Hope this will help :)
int itemToHide = 0;
[[objc_getClass("SBStatusBarStateAggregator") sharedInstance]
beginCoalescentBlock];
[[objc_getClass("SBStatusBarStateAggregator") sharedInstance]
_setItem:itemToHide enabled:NO];
[[objc_getClass("SBStatusBarStateAggregator") sharedInstance]
endCoalescentBlock];
please check this link. it's may help you.

Adding subviews on UIWindow covers the keyboard called by textfields

I am trying to imitate an alert view and i show a view with two text fields above a view with a translucent background. The problem is that when i try to tap on the text fields , the keyboard is shown behind my translucent view and i can't tap it no more. Is there a solution?
Here is my code:
if (_grayView==nil) {
_grayView = [[UIView alloc]init];
_grayView.frame = [[UIScreen mainScreen]bounds];
_grayView.backgroundColor = [UIColor blackColor];
_grayView.alpha = 0.7;
[[[[UIApplication sharedApplication] windows] lastObject] addSubview:_grayView];
}
//Show the dimensions view when choosing an image
_dimensionsView.hidden = NO;
[[[[UIApplication sharedApplication] windows] lastObject] addSubview:_dimensionsView];
In the _dimensionsView i have the textfileds.
What you're doing isn't a very good idea to begin with. Also be aware that you can't count on windows.lastObject to always be the window you expect. iOS 7 and 8 are more and more liberal with creating new windows for keyboards and modals. You might not be adding your subview to the window you're expecting.

Change tintcolor of navigationbar PKAddPassesViewController

I'm integrating a passbook system in my iOS app. I'm using the PassKit framework (Obviously ;) ). I'm using a custom tint color for all my navigation items. Is it possible to change the color of the 'Cancel' and 'Add' button? (From te PKAddPassesViewController) The blue looks horrible in my design.
thanks
In iOS 9 the button color can be changed. Subclass the PKAddPassesViewController and set the window tintcolor in viewWillAppear and make sure to set it back back in viewWillDisappear. Then use your subclass instead of PKAddPassesViewController:
MyPKAddPassesViewController.h:
#import <PassKit/PassKit.h>
#interface LHPKAddPassesViewController : PKAddPassesViewController
#end
MyPKAddPassesViewController.m:
#import "LHPKAddPassesViewController.h"
#implementation LHPKAddPassesViewController
- (void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
((UIWindow *)[UIApplication sharedApplication].keyWindow).tintColor = [UIColor greenColor];
}
- (void) viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
((UIWindow *)[UIApplication sharedApplication].keyWindow).tintColor = [UIColor whiteColor];
}
#end
There a simple way to do this in iOS 9. In the caller of PKAddPassesViewController use this:
PKAddPassesViewController *addToPassbookController = init...
[addToPassbookController.view setTintColor:[UIColor blackColor];
I don't think that you can change the tintcolor. Since iOS 6 such viewControllers are based on remote view controllers, meaning their view is completely owned by another process and inaccessible programatically.
This can be confirmed by looking at the recursive description of the controller's view:
<UIView: 0x140b0780; frame = (0 0; 320 568); layer = <CALayer: 0x140b0860>>
| | <_UISizeTrackingView: 0xe3b7300; frame = (0 20; 320 548); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0xe3b7410>>
| | | <_UIRemoteView: 0xe3b9b80; frame = (0 0; 320 568);
The _UIRemoteView indicates that the contents of the view is hosted in another process.
Edit:
Curiosly with MFMailComposeViewController it works. This viewController has an addressable navigationbarcontroller.
In Storyboard, Select navigationbar of your UINavigationController and then select the tint color
Hope this will help for you

Stuck white pixel in iOS app

I've got this weird issue with my iOS app where a stuck pixel often appears after a while using the application and I can't find where it came from.
I've even done the following with LLDB and it is still there:
expr [((UIWindow *)((UIApplication *)[UIApplication sharedApplication]).keyWindow) setHidden:YES] // and removeFromSuperview
The pixel disappears when you close the app and reappears when you open it again.
Any ideas on how I can debug this further? Unfortunately I haven't managed to reproduce it consistently.
EDIT: this managed to remove the pixel:
[(UIWindow *)[(NSArray *)((UIApplication *)[UIApplication sharedApplication]).windows objectAtIndex:2] setHidden:YES]
The objectAtIndex 2 was:
<UITextEffectsWindow: 0x14de6280; frame = (0 0; 768 1024); gestureRecognizers = <NSArray: 0x14dd77a0>; layer = <UIWindowLayer: 0x14deb7f0>>
Any ideas?
EDIT: narrowed it down more. The pixel was removed while debugging by doing this:
expr [((UITextMagnifierCaret *)[(NSArray *)((UIWindow *)[(NSArray *)((UIApplication *)[UIApplication sharedApplication]).windows objectAtIndex:2]).subviews objectAtIndex:0]) remove]

Positioning MPMoviePlayerController view

I got a little problem when trying to position the view of a MPMoviePlayerController. Here is my code so far.
MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:[[NSURL alloc] initFileURLWithPath:URL]];
moviePlayerController.shouldAutoplay = NO;
[moviePlayerController.view setFrame:CGRectMake((CGFloat)vidX, (CGFloat)vidY, (CGFloat)vidWidth, (CGFloat)vidHeight)];
//Find ApplicationWindow
id delegate = [[UIApplication sharedApplication] delegate];
UIWindow * win= [delegate window];
[win addSubview:moviePlayerController.view];
The code works fine and the movie is shown. However the positioning is making me crazy. When I change the width or the height of the view I expect the view to stay at the exact x and y position and only width and height should change. But this is not the case. When I change vidWidth or vidHeight and leave vidX and vidY untouched the origin of the view jumps to another point, which makes it extremely hard to position the video view.
Any help will be appreciated.
Best Regards,
Rambazamba

Resources