Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3773

Disabling implicit animation?

$
0
0

I’ve spent hours designing and building my app’s UI, and now I’ve hit a snag: I can’t disable iOS’s implicit animations, which creates a glitchy look when updating the UI in code.

Here, I’m synchronizing my view to the model just before I open my editor view. Programmatically setting the segment control’s index causes an implicit animation:

ezgif-1-698372bcdf

On iOS (Obj-C, Swift), I’d be able to set the value without animation, either by using a UIView animation block, a setter method that offered and “animated” parameter, or a CATransaction block, like so:

	[CATransaction begin];
	[CATransaction setAnimationDuration:0.0];

	// Update UI control values here

	[CATransaction commit];

I’ve tried the same code in XOJO, but it doesn’t work in my case. (Some functions here are using third-party iOS libraries.)

Dim CATransaction As ptr = NSClassFromString("CATransaction")

Declare Sub CATransaction_begin Lib UIKitLib Selector "begin" (id As ptr)
Declare Sub CATransaction_setAnimationDuration Lib UIKitLib Selector "setAnimationDuration:" (id As ptr, duration As Double)
Declare Sub CATransaction_commit Lib UIKitLib Selector "commit" (id As ptr)

CATransaction_begin(CATransaction)
CATransaction_setAnimationDuration(CATransaction, 0.0)

// Set my UI control values
Me.PTTS_BorderWidth.TRMSS.SnapValue = Integer(PTGlobals.BorderWidthPreset)
Me.SB_BorderColor.SelectedSegmentIndex = Integer(PTGlobals.BorderColorPreset)

CATransaction_commit(CATransaction)

Various other tricks, such as hiding the control, setting it, and showing it, didn’t work. I really don’t want to set up a UIView animation block because it’s going to be tedious to implement everywhere I’m updating the UI.

Perhaps I’m missing something simply?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 3773

Trending Articles