Extending Background Objective-C - ios

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.

Related

SF Symbols Multicolored icons

Im making an app with weather icons, and i wanted to use apple's SF Symbols! At WWDC2020 they released multicolred ones.
So my question is, why are my icons appearing in black like so:
I have set the rendering mode to alwaysOriginal. And it does nothing. If i set it to template it becomes blue, like the default tint color.
currentConditionImageView.image = UIImage(systemName: "cloud.sun.fill")!.withRenderingMode(.alwaysOriginal)
But according to the SF Symbols app, the symbol should look like this:
Has anyone encountered this Problem, and how did you solve it?
Im looking forward to your answers!
The rule is:
In a template environment, such as a button, if you apply the .alwaysOriginal rendering mode to a multicolor symbol image, its inherent colors will appear.
But an image view is not a template environment. Try making this image the image (not the background image) of a UIButton.
If you put a multicolored image in a non-template environment, like an image view, you are basically misusing it if you make it .alwaysOriginal. You should just make it .alwaysTemplate and accept it as a monochrome image adopting the tint color.

iOS Extension with transparent background

I would like to add transparency to iOS widget, but it looks like it is not supported by default.
Most widgets are non transparent, but I have an example of transparent one.
That's why I ask you about any tips on how to implement such feature for widgets.
Thanks in advance!
Short answer is you can't (as of iOS 14.5).
Most "pseudo-transparent" non-Apple widgets involve asking the user for the wallpaper they're using, then cropping it accordingly and using the result as a widget's background, creating an illusion of transparency at that exact widget position. This can (and will) break parallax and other such effects.
That is if we're talking WidgetKit, of course; legacy Today widgets may give you a bit more freedom, although you likely won't achieve full transparency without hacks like above.
Vym is right. We just developed a widget app that can implement such a pseudo-transparent effect.
Hoping this might help others who want to achieve such effect.
Here is how:
Guide the user to take a screenshot(with current wallpaper) on a blank home screen, and save it.
Tell the user to provide the widget with the widget position. This can be done via the Siri Intents Extension.
public enum WidgetCropPosition: Int {
case smallTopLeft
case smallTopRight
case smallCenterLeft
case smallCenterRight
case smallBottomLeft
case smallBottomRight
case mediumTop
case mediumCenter
case mediumBottom
case largeTop
case largeBottom
}
Crop the saved wallpaper according to the widget position.
The pain point here is the widget of the same position does don't have the same frame location on different devices. You have to do a lookup the table to find the correct position.
This is a Swift Package that helps to crop the correct frame on different iOS devices.Translucent

List with system background color gets messed up in dark mode

I am trying to set a background color for a List that will adapt to the iOS mode (light/dark).
I use .systemGray5 without problems in VStacks but when using it in Lists and I change to dark mode I get a very dark, almost black color which makes everything unintelligible.
This happens regardless if the list is dynamic or static. Is this a bug? Or is there an alternative way to do it?
List {
Text("Privacy").foregroundColor(Color(.systemRed))
}.colorMultiply(Color(.systemGray5))
The problem is that colorMultiply will multiply all colors in the list (text, background, separator) with the given color (see multiply color blending). This will darken the whole view, which probably looks okayish in light mode, but is the opposite of what you want to do in dark mode.
There are two ways to change the background colors in a List:
List {
Text("Privacy").foregroundColor(Color(.systemRed))
.listRowBackground(Color(.systemGray5))
}
.background(Color(.systemGray5))
background will change the background of the whole List, but I guess this is only really visible in grouped lists, since the cells usually don't have any space between them.
listRowBackground changes the background color of a view when it's used in a List environment. That's probably what you want to use here.
Frank Schlegel provided an answer which works only for static lists. Until Apple fixes this for dynamic lists I solved my problem by using this code
List {
ForEach(pumpData) { pump in
Text("pump").listRowBackground(Color(.systemGray5))
}
}.background(Color(.systemGray5))
.secondarySystemGroupedBackground worked for me.

How do I change the color of the push notification icon in flutter? [duplicate]

I tried making the small icon exactly 16x16, gray-scaled, nothing but gray and white (the gray color being hex value 616161), to create a silhouette of my application icon.
Yet no matter what it just shows up as a white/gray square in the notifications. What am I doing wrong?
(My min api is 21, assuming it is relevant)
Follow this link
First let’s understand the Android documentation which is as follows
“Update or remove assets that involve color. The system ignores all
non-alpha channels in action icons and in the main notification icon.
You should assume that these icons will be alpha-only. The system
draws notification icons in white and action icons in dark gray.”
Now this is easy to miss and I have seen many apps that are live in the app store with thousands of users who haven’t followed the mentioned guidelines.
So let me explain in detail how you can convert your notification icon to an Android friendly one with a few clicks.
In your favourite image editor open up your icon file. Convert all parts of the image that you don’t want to show to transparent pixels. All colors and non transparent pixels are displayed in white. Let us go through an example.
EDITED: Thanks #Andrey Patseiko for the tool
For notification you have to use different icons for different versions of android:
Notification notification = new Notification.Builder(context)
.setAutoCancel(true)
.setContentTitle("My notification")
.setContentText("Look, white in Lollipop, else color!")
.setSmallIcon(getNotificationIcon())
.build();
return notification;
Get notification icon on the basis of version
private int getNotificationIcon() {
boolean useWhiteIcon = (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP);
return useWhiteIcon ? R.drawable.icon_silhouette : R.drawable.ic_launcher;
}
Along with new features and capabilities, Android 5.0 includes a variety of system changes and API behavior changes. See the notification behavior changes.
Notifications are drawn with dark text atop white (or very light)
backgrounds to match the new material design widgets. Make sure that
all your notifications look right with the new color scheme. If your
notifications look wrong, fix them:
Use setColor() to set an accent color in a circle behind your icon image.
Update or remove assets that involve color. The system ignores all non-alpha channels in action icons and in the main notification icon.
You should assume that these icons will be alpha-only. The system
draws notification icons in white and action icons in dark gray.
So, basically you have to use silhouette icons as notification icon for API Level 21+

CCTurnOffTiles tints my CCSprites

Cocos2d-iPhone version 1.0.1.
I am using CCTurnOffTiles action on a CCSprite (.png image, not animated).
Sometimes, everything goes smoothly. Other times, the sprite seems to be tinted. The tint color seems to be mostly green.
My AppDelegate has the settings I was suggested here: CCLiquid renders my screen black
This is part of my original sprite:
And this is how it looks:
This is the action code:
id myAction = [[CCTurnOffTiles actionWithSize:ccg(35, 20) duration:0.7] reverse];
I use reverse because I want my tiles to turn ON rather than OFF. But I believe that the problem persists either way.
Why might this be happening?

Resources