Post

Replies

Boosts

Views

Activity

Masking bottom view controller during UINavigationController transition
I am trying to make my UINavigationController and its children transparent such that the content behind them can be seen. However, simply setting backgroundColor = .clear isn't enough, as there is now an issue that during push/pop transitions, the bottom child view controller is visible through the transparent top child view controller. I have worked around this by setting the layer.mask of the bottom view controller's view, and updating the mask bounds on every animation frame so that it appears that the top view controller is covering the bottom one, even though they are both transparent. There are a few questions I have about this approach: Is there a way to achieve this affect without manually masking the views? Can I update the masks during the animation without running a rapid timer? UINavigationController inserts a view of type _UIParallaxDimmingView between the two view controllers during the transition, which also needs to be masked. Is there a better way to obtain a reference to this view other than my current approach (searching for a subview with a non-nil background color) I have uploaded some sample code - https://gist.github.com/jayrhynas/ac38b321eb5ac5e83b92b1686aae2a91 as well as a full sample project - https://github.com/jayrhynas/TransparentNavigationControllerExample.
0
0
460
Jun ’20
Crop UIView Snapshot
I'm implementing a custom UINavigationViewController transition, and as part of the animation I want to snapshot and transform the destination UIViewController. However, I want to slice the snapshot and transform the parts independently.There is a comment in UIView.h that seems to indicate that this is possible and even recommended:Creating snapshots from existing snapshots (as a method to duplicate, crop or create a resizable variant) is supported. In cases where many snapshots are needed, creating a snapshot from a common superview and making subsequent snapshots from it can be more performant.However, I cannot figure out how to actually do the cropping or create multiple snapshots from the common superview snapshot.Is this possible?Note: I did investigate using UIView.drawHierarchy(in:afterScreenUpdates:) to create an image that I can later crop, however this fails during a UINavigationController transition with the following error:[Snapshotting] View (0x140853600, MTKView) drawing with afterScreenUpdates:YES inside CoreAnimation commit is not supported.
2
0
2.9k
Nov ’18
AUSampler crash: 'breaking out of infinite loop'
I have an AUSampler and occassionally my app will crash with a log message 912: BREAKING OUT OF INFINITE LOOP. The stack trace is:#0 0x000000018515b548 in VoiceZone::Process(unsigned long long, AudioBufferList**, unsigned int, unsigned int) () #1 0x00000001852a17bc in SamplerNote::Render(unsigned long long, unsigned int, AudioBufferList**, unsigned int) () #2 0x00000001852a1b28 in non-virtual thunk to SamplerNote::Render(unsigned long long, unsigned int, AudioBufferList**, unsigned int) () #3 0x000000018544abf4 in SynthGroupElement::Render(long long, unsigned int, AUScope&) () #4 0x000000018544f588 in AUInstrumentBase::Render(unsigned int&, AudioTimeStamp const&, unsigned int) () #5 0x000000018520f168 in SamplerBase::Render(unsigned int&, AudioTimeStamp const&, unsigned int) () #6 0x0000000185445480 in AUBase::DoRenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, AUOutputElement*, unsigned int, AudioBufferList&) () #7 0x0000000185444c0c in AUBase::DoRender(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int, AudioBufferList&) () #8 0x000000018544dfb0 in AUMethodRender(void*, unsigned int*, AudioTimeStamp const*, unsigned int, unsigned int, AudioBufferList*) () #9 <my code> This only seems to happen with certain presets and certain combinations of events, although I haven't figured out the pattern. Does anyone know why this may be happening and how to prevent it?
2
0
1.3k
Dec ’17
Update MPRemoteCommandCenter play button
I have an iOS 9 app that plays MIDI-like songs using an AudioGraph. I've set up remote control commands with MPRemoteCommandCenter and info with MPNowPlayingInfoCenter such that the currently playing song shows up in Control Center and responds to control center button presses or headphone button presses. Tapping the pause button in Control Center pauses my song, but the playhead in Control Center keeps moving and the button remains as a pause icon. Tapping it again just keeps calling pause. Is there a way to update the MPNowPlayingInfoCenter or MPRemoteCommandCenter state such that Control Center knows the song is paused?Solutions I have tried:Setting enabled on playCommand and pauseCommandhas no effectSetting MPNowPlayingInfoPropertyPlaybackRate to 0 in MPNowPlayingInfoCenterstops the playhead from advancing (and resets the elapsed time if I don't explicitly set it as well), but the button is still a pause buttonStopping my audio engine and calling AVAudioSession.setActive(false)this does seem to work, but it is slow, causes audio glitches, and other parts of my app rely on the audio engine running even if a song is paused
3
0
2.5k
Apr ’16