How to add image in UITableViewRowAction?
Finally in iOS 11, SWIFT 4 We can add add image in UITableView's swipe action with help of UISwipeActionsConfiguration
@available(iOS 11.0, *)
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let action = UIContextualAction(style: .normal, title: "Files", handler: { (action,view,completionHandler ) in
//do stuff
completionHandler(true)
})
action.image = UIImage(named: "apple.png")
action.backgroundColor = .red
let configuration = UISwipeActionsConfiguration(actions: [action])
return configuration
}
WWDC video at 28.34
Apple Doc
Note: I have used 50*50 points apple.png image with 50 tableview
row height
How do you set the avatar of API-triggered messages?
When sending messages through a web-request - you can supply the icon_emoji
property with a supported emoji name, such as:
{
..
"icon_emoji":":ghost"
}
Or, with an icon_url
property:
{
..
"icon_url":"<your valid url>"
}
Create a User with Profile Picture with Parse in Swift
Please check below code , add a photo fields into your user table with parse.com
var user = PFUser()
let imageData = UIImageJPEGRepresentation(userDetails.getPhoto(), 0.05)
let imageFile = PFFile(name:"image.jpg", data:imageData)
imageFile.save()
user.username = usrEntered
user.password = pwdEntered
user.email = emlEntered
user.setObject(imageFile, forKey: "photo")
user.signUpInBackgroundWithBlock {
(succeeded: Bool!, error: NSError!) -> Void in
if error == nil {
// Hooray! Let them use the app now.
self.messageLabel.text = "User Signed Up";
} else {
// Show the errorString somewhere and let the user try again.
}
}
Related Topics
Accessibility (Voice Over) with Sprite Kit
Implicit Cast Function Receiving Tuple
Swift: Overriding Typealias Inside Subclass
Having Trouble with Nstimer (Swift)
Nsurlsessiondatadelegate Method Didreceivedata and Others Are Not Called
From Any Utf-16 Offset, Find the Corresponding String.Index That Lies on a Character Boundary
Swift How to Assign a String to a Uitextfield
How to Prevent Eventstore Access Error on First Run
Swift Class Doesn't Like Self.View.Addsubview()
Swift Get Nsdata of a Video from Photos Library
Cloudkit Ckqueryoperation Doesn't Get All Records
Gmsplace Returns Invalid Coordinate (-180, -180), But Name and Place Id Are Correct
Swift Extension Storage for Protocols
More Concise Way to Nest Enums for Access by Switch Statements in Swift
Combining Custom Property Wrapper with @Published