I'm using PKPaymentButton for ApplePay integration but want to know if I can customize it easily.
let applePayButton = PKPaymentButton(type: PKPaymentButtonType.setUp, style: PKPaymentButtonStyle.black)
Can we change the button style?
After setup of ApplePay, I wanted to change the buttonType to .buy but didn't find a solution.
Can we remove corner radius?
Default ApplePay button has corner radius. I don't like it and tried to remove it. So, I tried to work with layer but it didn't work.
applePayButton.layer.cornerRadius = 0
Please let me know if I can change the ApplePay button properties easily.
Yes you can change it by recreating PKPaymentButton with different PKPaymentButtonStyle in runtime. Or you can write your own PKPaymentButton wrapper that will do it for you.
Though Apple doesn't recommend to alter Apple Pay Button appearance, it's doable. Again, using your PKPaymentButton wrapper, place Apple Pay button in the center and alter corner radius of your wrapper button, you can change size of icons in that way too. I did it in some of my projects and didn't get a word from Apple.
You can also change the appearance of the button with his runtime attributes:
[self.applePayButton setValue:#(0) forKey:#"style"];
Pass 0 for a black button and 2 for a white Apple Pay Button
In the Apple Pay Identity Guidelines, Apple states that you should not change the corner radius of the Apple Pay button (PKPaymentButton).
Related
is it possible to change color of bottom horizontal line of iPhone X series within app(inside app only)? my client is asking to change color of this line, and i am not able to find any related topic or solution.
Thanks.
No, I don't think it is. That's drawn by the system, and is not part of your app. Apple does not let apps change things outside of that app's "sandbox".
Edit:
I found a long article on the subject online:
https://medium.freecodecamp.org/reverse-engineering-the-iphone-x-home-indicator-color-a4c112f84d34
It seems it's called the "home indicator" and this author supports my suspicion that you can't change its color.
Edit #2
As Matt points out, the color of the home indicator changes automatically. The system has logic in it that tries to keep enough contrast between the home indicator and the area around it so that it's clearly visible. See the article I linked for more on that subject than you probably wanted to know.
You can only remove it:
override var prefersHomeIndicatorAutoHidden: Bool {
return true
}
The color is applied automatically.
I've Required an iOS application with a black theme, and would really like to make the displayed Apple Map also in black colors.
I see nothing in the native documentation that talks about changing look for MKMapView.
I've Googled the topic and tried to change MKOverlayView.But, I couldn't find anything.
Is this even possible? Can I change the background colors of the Apple Map.
Thank you.
You can customize map using MapBoxKit
https://www.mapbox.com/ios-sdk/api/3.6.4/runtime-styling.html
In Mapkit you can only set dark mode as hybrid as follow:
in viewDidLoad write below code:-
mapView.mapType = .Hybrid
Need to add Privacy - Photo Library Usage Description in info.plist
also you can set from IB as above:-
Rather than creating a custom keyboard...how can I change the ios keyboard background image and get reference of the keyboard button or just the keyboard view programatically?
I do not want to replicate the whole ios keyboard, just tweak the keyboard here and there.
Solution Update:
You cannot update only the background or the buttons of the iOS System Keyboard! This is dues to the reason that Apple has limited the access to the Keyboard API. The most you can do is change the keyboard background color i.e. dark or light.
If you need to change the background to an image like me, you need to extend the ios keyboard i.e. make your own custom keyboard!
Please check below for accepted answer!
Hope this helps!
You can do something like this,
myTextField.keyboardType = UIKeyboardTypeDecimalPad; // many other options
myTextField.keyboardAppearance = UIKeyboardAppearanceDark; //many other options
If you want totally customize keyboard then refer this tutorial.
Hope this will help :)
For dark background you can use
mytextfield.keyboardAppearance = UIKeyboardAppearanceAlert;
For more customisation follow this link:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITextInputTraits_Protocol/index.html
When I was watching one of the videos from Apple about the Apple Watch and its features I noticed that the page indicator dot colours change depending on the page presented.
They've also got images of the coloured dots within the Apple Watch Human Interface Guidelines App Anatomy section. Note the coloured title text as well.
Normally in WatchKit I would use the following snippet of code to do this:
let features = ["First", "Second", "Third"]
let controllers = [String](count: features.count, repeatedValue: "FeatureInterfaceController")
self.presentControllerWithNames(controllers, contexts: features)
Unfortunately as far as I know there isn't a way to access the currentPageIndicatorTintColor and pageIndicatorTintColor as you normally would as part of UIKit here (scroll down to Tint Color).
I wonder if Apple simply just added those colours for the video or whether they're actually going to be available as part of WatchKit in the future?
Perhaps I'm wrong and there is a way to change these dot colours.
As written by an Apple Engineer in the Dev Forums, it's not possible to customize the color of the page control at this time.
Source: https://devforums.apple.com/message/1100695#1100695
On iOS 7.0.3 turning on increased contrast mode removes the blur effects you'd normally see in the nav bar if you're using a bar tint color with an alpha less than 1.0, which makes the nav bar seem much more transparent than it is with the default settings.
Is there a way to programmatically check to see if this setting is enabled? While UIAccessibility has a ton of other functions like UIAccessibilityIsInvertColorsEnabled(), I can't find anything related to this setting specifically.
As of iOS 8 there is a way to check:
UIKIT_EXTERN BOOL UIAccessibilityDarkerSystemColorsEnabled() NS_AVAILABLE_IOS(8_0);
as of modern iOS:
UIAccessibility.isDarkerSystemColorsEnabled
Apparently there's no public API for checking whether that option is on.
According to the UIKit Function Reference, the only checks you can perform are the following
UIAccessibilityPostNotification
UIAccessibilityIsVoiceOverRunning
UIAccessibilityIsClosedCaptioningEnabled
UIAccessibilityRequestGuidedAccessSession
UIAccessibilityIsGuidedAccessEnabled
UIAccessibilityIsInvertColorsEnabled
UIAccessibilityIsMonoAudioEnabled
UIAccessibilityZoomFocusChanged
UIAccessibilityRegisterGestureConflictWithZoom
UIAccessibilityConvertFrameToScreenCoordinates
UIAccessibilityConvertPathToScreenCoordinates
For iOS 13 and above we can use accessibilityContrast
Documentation
Use this trait to determine whether the user requested a high contrast
between foreground and background content. The user sets the contrast
level in the Accessibility area in Settings.
Apple doc link