HamzaGhazouani/HGPlaceholders

custom action button

Binusz opened this issue · 2 comments

Are there any way to change action button with own custom button ? Or do you have any plan ?

Hi @Binusz ,
Yes you can custom the button using a xib file:

let xibPlaceholder = Placeholder(cellIdentifier: "CustomPlaceholderCell", key: PlaceholderKey.custom(key: "XIB"))
placeholdersProvider.add(placeholders: xibPlaceholder)

If you would like to change only text and background, you can do like that:

var starwarsStyle = PlaceholderStyle()
starwarsStyle.actionBackgroundColor = .clear
starwarsStyle.actionTitleColor = .white
       
 var starwarsData = PlaceholderData()
 starwarsData.action = NSLocalizedString("OK!", comment: "")
       
let placeholder = Placeholder(data: starwarsData, style: starwarsStyle, key: PlaceholderKey.custom(key: "starWars"))

Actually, I just want to use my own custom button on your default placeholder without xib file. But you're right. the best way is using a xib file.