Git Product home page Git Product logo

Comments (12)

mhupman avatar mhupman commented on September 26, 2024

Are you pushing the new controller as a modal or onto the navigation stack?

from mbcontactpicker.

brunchboy avatar brunchboy commented on September 26, 2024

Onto the navigation stack.

from mbcontactpicker.

mhupman avatar mhupman commented on September 26, 2024

I'm not able to reproduce this behavior yet. Can you take a look at the demo project @ 8cfc85a? I've updated it to include a navigation controller and a button to push a new view onto the stack (it's sitting on top of the prompt label, called "Present"), attempting to replicate the conditions you've described. Let me know if you can reproduce in the demo or if something in my understanding is off!

Please forgive the wacky initial presentation of the contact picker, that has something to do with the nav controller being present.

from mbcontactpicker.

brunchboy avatar brunchboy commented on September 26, 2024

I can’t reproduce it in your modified demo project either. I will see if I can come up with a way to make it happen in the demo project for you, but probably won’t have time tonight.

from mbcontactpicker.

brunchboy avatar brunchboy commented on September 26, 2024

One difference is that we are not using a segue, but rather:
[self.navigationController pushViewController:recipientSelectViewController animated:YES];

from mbcontactpicker.

brunchboy avatar brunchboy commented on September 26, 2024

Well, I have not been able to explain this yet, nor come up with a standalone sample project outside the context of our app which exhibited the problem (although I have not had much time to spend on trying to do that, alas). While debugging through the code I did find an instance where the MBContactCollectionViewContactCell ended up with a textColor that was the same blue tint as the backgroundColor and I am at a complete loss as to how that might have occurred.

However, I have found a workaround that makes everything look fine: If I add a [self.picker reloadData]; to the view controller’s viewDidAppear: method, then the problem does not manifest itself.

I am not entirely happy with needing that workaround, but until I have more time to spend in the debugger (or creating a more complete sample program), I don’t see what you will be able to work with in tracking this down. Do you have any hints for me?

from mbcontactpicker.

mhupman avatar mhupman commented on September 26, 2024

Very odd indeed. Perhaps it has something to do with tintColor? One idea would be to set a Symbolic Breakpoint in XCode for something like -[UILabel setTextColor:]. That way, if something is messing with the UILabel's textColor during the presentation/dismissal of the view controller, we could identify it in the stack trace.

The reloadData sucks because you lose any highlighted cells. I really wish I could get a standalone example of this to debug on...

from mbcontactpicker.

brunchboy avatar brunchboy commented on September 26, 2024

I feel your pain! I will try both of those things, symbolic breakpoints and seeing if I have any more luck in getting you a standalone example. But the problem of losing the highlighted cells is not an issue for us, given that we already call resignFirstResponder upon pushing to our alternate view, which is supposed to deselect anything that was selected within the collection view.

from mbcontactpicker.

brunchboy avatar brunchboy commented on September 26, 2024

Well, I have been having fun in LLDB, but am not much the wiser. When pushing to and from our subview via the navigation controller, the picker does get a bunch of setFocus invocations caused by a tint-color change notification which seems to happen during a layout operation, as shown in the sample stack trace below.

Setting symbolic breakpoints is complicated by the fact that UILabel doesn’t have its own implementation of setBackgroundColor: and so I had to stop on all methods with that name, and try to winnow them down. My best guess as to the real one involved is -[UIView(Rendering) setBackgroundColor:]

I think it is time to go back to trying to produce a standalone sample project which exhibits the problem.

So here is the promised stack trace of an unexpected tint color change:

#0  0x01b63211 in -[UILabel setTextColor:] ()
#1  0x000a6356 in -[MBContactCollectionViewContactCell setFocused:] at /Users/james/Projects/ICMobile/Pods/MBContactPicker/MBContactPicker/MBContactCollectionViewContactCell.m:91
#2  0x000a5d46 in -[MBContactCollectionViewContactCell tintColorDidChange] at /Users/james/Projects/ICMobile/Pods/MBContactPicker/MBContactPicker/MBContactCollectionViewContactCell.m:63
#3  0x01a1eafb in -[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] ()
#4  0x01a1ec04 in -[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] ()
#5  0x01a1ec04 in -[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] ()
#6  0x01a1ec04 in -[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] ()
#7  0x01a1ec04 in -[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] ()
#8  0x01a1ec04 in -[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] ()
#9  0x01a1ec04 in -[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] ()
#10 0x01a1ec04 in -[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] ()
#11 0x01a1ec04 in -[UIView(Internal) _recursiveNotifyInteractionTintColorDidChangeForReasons:] ()
#12 0x01a12605 in __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke ()
#13 0x00ec938c in -[NSISEngine withBehaviors:performModifications:] ()
#14 0x00d58f05 in -[NSISEngine withAutomaticOptimizationDisabled:] ()
#15 0x01a123bd in -[UIView(Hierarchy) _postMovedFromSuperview:] ()
#16 0x01a1d4c1 in -[UIView(Internal) _addSubview:positioned:relativeTo:] ()
#17 0x01a109b1 in -[UIView(Hierarchy) addSubview:] ()
#18 0x019a9848 in __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke ()
#19 0x01a173ef in +[UIView(Animation) performWithoutAnimation:] ()
#20 0x019a8c96 in -[_UINavigationParallaxTransition animateTransition:] ()
#21 0x01ae3e4e in -[UINavigationController _startCustomTransition:] ()
#22 0x01af00c7 in -[UINavigationController _startDeferredTransitionIfNeeded:] ()
#23 0x01af0cb9 in -[UINavigationController __viewWillLayoutSubviews] ()
#24 0x01c2a181 in -[UILayoutContainerView layoutSubviews] ()
#25 0x1072556f in -[UILayoutContainerViewAccessibility(SafeCategory) layoutSubviews] ()
#26 0x01a20267 in -[UIView(CALayerDelegate) layoutSublayersOfLayer:] ()
#27 0x02e8c81f in -[NSObject performSelector:withObject:] ()
#28 0x0177c2ea in -[CALayer layoutSublayers] ()
#29 0x017700d4 in CA::Layer::layout_if_needed(CA::Transaction*) ()
#30 0x0176ff40 in CA::Layer::layout_and_display_if_needed(CA::Transaction*) ()
#31 0x016d7ae6 in CA::Context::commit_transaction(CA::Transaction*) ()
#32 0x016d8e71 in CA::Transaction::commit() ()
#33 0x016d9544 in CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) ()
#34 0x030bf4ce in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#35 0x030bf41f in __CFRunLoopDoObservers ()
#36 0x0309d344 in __CFRunLoopRun ()
#37 0x0309cac3 in CFRunLoopRunSpecific ()
#38 0x0309c8db in CFRunLoopRunInMode ()
#39 0x0522b9e2 in GSEventRunModal ()
#40 0x0522b809 in GSEventRun ()
#41 0x019b5d3b in UIApplicationMain ()
#42 0x0002e17d in main at /Users/james/Projects/ICMobile/main.m:16

from mbcontactpicker.

brunchboy avatar brunchboy commented on September 26, 2024

If this helps jog loose any ideas, the picker scrolls back into view looking fine, and then a fraction of a second after the view has appeared, the blue rounded rectangle(s) get drawn over the cell(s) unexpectedly.

It doesn’t look like I can get it to embed right, but you can see a movie of it here:
http://www.brunchboy.com/media/PickerGlitch.mov

from mbcontactpicker.

mhupman avatar mhupman commented on September 26, 2024

The rabbit hole goes deeper. It's odd that you see a delay before the cell is incorrectly highlighted. Can you breakpoint in viewWillAppear and viewDidAppear and identify where in the lifecycle the view is colored incorrectly? In my example project, all tinting takes place between viewWillAppear: and viewDidAppear, I don't see any setTextColor or setBackgroundColor calls after viewDidAppear. I've also updated my demo branch, there is a pretty simple change you can make to isolate the symbolic breakpoints to just the contact labels in question.

from mbcontactpicker.

mhupman avatar mhupman commented on September 26, 2024

Closing due to stale-ness and inability to reproduce. @brunchboy If this is still a problem or if we can get a reproducible test case, I'll be happy to re-open and address.

from mbcontactpicker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.