How do you animate a lock screen widget on iOS 16? - ios

In iOS 16, Lock screen widgets allow you to add an Image to the WidgetView, like in accessoryCircular.
How do you animate this Image? Loading the Image from an animated UIImage with frames just displays the first frame.
Am I missing a startAnimating call, like you have to do with WKInterfaceObjects? Is there some additional step or value to set to get an Image inside a SwiftUI WidgetView to begin animating, or cycling through frames?
Examples of apps that have achieved this are https://www.livelywidget.com or Pixel Pal, so I know it's possible, but when I search for APIs to accomplish this, all that comes up are apps.

Related

UITabBar Large Content Size Image (HUD) doesn't display in Large Text mode

iOS 11 has an accessibility feature that shows a large version of a tabbar icon in a pop-up HUD when long pressed. In a WWDC presentation, it was mentioned this just involves turning on:
Settings -> General -> Accessibility -> Larger Text
..and adding:
tabBarItem.largeContentSizeImage = UIImage(named: "myHud")
Alternatively, you can add a vector image as the main tool-bar image, with 'Preserve Vector Data' checked in the asset catalog.
I've tried all combinations of this, and a long press does not show the HUD. I also tested with the Files app on my iPad running iOS 11b4 with no luck. This is the app that was demoed at WWDC.
Is there some other accessibility setting I'm missing to enable this feature? Or is it not available in beta 4?
It isn't enough to turn on Larger Text. You also have to use Larger Text — i.e. slide the slider way to right.
Then it works — well, the HUD appears. But the icon is not being enlarged within the HUD, so I don't quite see the point:
(As you can see, I'm doing this in a test project where I'm experimenting with the vector PDF image feature.)
This feature implementation and an example with tab bar are perfectly explained with illustrations on this accessibility site but here are the outlines :
Under Xcode, import the image to be enlarged with a pdf extension and a x1 resolution in the xcassets catalog.
In the new Image Set, tick Preserve Vector Data and specify Single Scale as Scales attribute.
If a storyboard is used for this image, tick Adjusts Image Size in the Image View section, otherwise put the adjustsImageSizeForAccessibilityContentSizeCategory image property to true in code.
For your tab bar or tool bar used in the application, first repeat the previous 3 steps for each image included in the items to be enlarged in the middle of the screen and then link the accessibility image to its appropriate item.
This feature is available only for the accessibility text sizes.
WARNING : don't forget to check your layout with these new images larger sizes.
For your record, an explanation of the Large Content Viewer is provided in this detailed WWDC video summary if need be ⟹ the UILargeContentViewerItem protocol is an iOS 13 new feature that shows the same HUD that's shown for standard bar items.
You need to go :
Settings > General > Accessibility > Larger Text(set on) > Move slider more then half to the right
Don't forget to set
tabBarItem.largeContentSizeImage = someKindOfImage
And Long press will does the trick.

iOS: Launch image gets wrinkled in the center during a call/recording/hot-spot session

I use a set of launch images for my app and noticed that when I'm having a call, recording a voice note or sharing my Internet connection and put that activity in the background and launch my app, the launch screen is wrinkled in the center. Is there anything I can do to make the image look ok or is it just a standard iOS behavior?
Just define a key in plist file will solve your problem
Status bar is initially hidden = YES
OK, the solution I found is to hide status when launching the app, just like here
Seems like Apple "take" 4% of screen space from the middle of the screen (as far as I tested) to give it to status bar. Personally I faced this problem when using iPhone modem mode.
So if it is not critical for image to be centered vertically - the solution would be to place image above/below this "4% middle screen area".
Examples when image is cropped:
How image should look(image centered vertically & horizontally, width & height are fixed size)
How it actually looks
Example when image looks as supposed to (but not centered) :
Constraints example
Image with new constraints example

Centering PickerIOS in React Native

I have been trying to center a PickerIOS, but I am probably missing the underlying logic behind a Picker, because I just want its width to be full screen.
I can manage to do that with iPhone 4s / 5s, but when I run it on the iPhone 6, the Picker seems to be on the left, with some space on the right side.
I have been trying to use alignItem:'center' with a wrapper around the picker, but that just makes it disappear. I have also tried alignSelf, but still doesn't work.
I thought that Picker, by default, had its width to full screen or does it adapt according to the length of the elements?
Do I have to place it in a Flexbox in order to get it centered with a full screen width?
mask1: {
height:120,
overflow:'hidden',
justifyContent:'space-around',
marginTop:50
}
I find out that the style of PickerIOSItem cannot change, and only works fine in NavigatorIOS. I review the example of UIExplorer and there is no more style binding to the Item. Maybe it's a bug.

how to take a UIView screenshot faster?

I'm making a dictionary app, which allows user find a word definition by touch the word in screen, and there will be a magnifier on screen and follow user's finger. I have implement it by take a screenshot of view and assign the image to maginifer image view, which is a UIImageView, however, in order to take a screenshot, the method [self.layer renderInContext:c]; cost too much time, is there any other way to do it ?maybe openGL will help?
after profiling my app with instruments->core animation, it is only 9 fps showing magnifier, but it will 30 fps if showing the system default magnifier in a UITextView, I don't know why the system is so fast
You can use exact same view in magnifier view, and change position to visible words.
There are new methods in iOS 7 that are highly optimized :
– snapshotViewAfterScreenUpdates:
– resizableSnapshotViewFromRect:afterScreenUpdates:withCapInsets:
– drawViewHierarchyInRect:afterScreenUpdates:
However they are not available in previous versions.

Extending Background Objective-C

I am making a jailbreak tweak that involves the multitasking switcher tray opening up a bit higher than normal... This causes there to be a black bar above the linen background image... How can I extend the linen image, or repeat it somehow so that it looks seamless?
The linen is in class SBAppSwitcherBarView
it is called SBLinenView
Thanks! :)
You'll want to create a new SBLinenView and place it where you want to extend it. You can do this by using SBLinenView's +(id)squareImageForBounds:(CGRect)bounds which returns a square UIImage of the bounds you pass it.

Resources