How to create “Add to apple wallet” button using PKAddPassButton for passes with localisation

烂漫一生 提交于 2019-12-13 03:52:12

问题


In my iOS project I have a screen which allows the user to create apple passes and add it to the wallet. Apple recommends creating "Add to apple wallet" button using PKAddPassButton. When I tried creating apple pass using following code:

let passButton =  PKAddPassButton(addPassButtonStyle: PKAddPassButtonStyle.black)
passButton.frame = CGRect(x:45.0, y: 340.0, width: 320, height: 50)
view.addSubview(passButton)

Button has got couple of issues:

  1. Wallet image is not visible.
  2. Even after changing the language at device level won't localise the text.

Should I use some custom UIButton to achieve this? Any help is appreciated.


回答1:


I found the answer, I was testing the code on simulator.When tested the same on device it worked and also localisation is taken care by iOS. If the user changes device language in settings it directly gets reflected in "Add to Apple wallet button".



来源:https://stackoverflow.com/questions/49773184/how-to-create-add-to-apple-wallet-button-using-pkaddpassbutton-for-passes-with

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!