editActionsForRowAtIndexPath for one section iOS Swift

override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool{
return indexPath.section == 0 ? true : false

thời gian

coi trọng từng giây, coi trọng từng phút, nỗ lực và nỗ lực không ngừng…

without storyboard

let leadingMargin = NSLayoutConstraint(item: self.tableView, attribute: NSLayoutAttribute.LeadingMargin, relatedBy: NSLayoutRelation.Equal, toItem: self.view, attribute: NSLayoutAttribute.LeadingMargin, multiplier: 1, constant: 0.0)

let trailingMargin = NSLayoutConstraint(item: self.tableView, attribute: NSLayoutAttribute.TrailingMargin, relatedBy: NSLayoutRelation.Equal, toItem: view, attribute: NSLayoutAttribute.TrailingMargin, multiplier: 1, constant: 0.0)

OAStackView stack

/*func initNewMapview() {
let stackView1 = OAStackView(arrangedSubviews: [
stackView1.alignment = .Fill
stackView1.distribution = .Fill
stackView1.axis = .Vertical
stackView1.spacing = 25


drop = UIDropDown(frame: CGRect(x: 0, y: 0, width: 60, height: 20))
drop.tintColor = UIColor.blueColor()
drop.backgroundColor = UIColor.redColor()
drop.options = ["VND","USD","THB","JPY","RUB","EUR"]
drop.placeholder = "VND"
drop.delegate = self
drop.snp_makeConstraints { (make) -> Void in

color should remember swift.

add image with title to custom cell action swipe

let tableViewRowAction = BGTableViewRowActionWithImage.rowActionWithStyle( UITableViewRowActionStyle.Default, title: "Delete".localized(), titleColor: UIColor.blackColor(), backgroundColor: UIColor.whiteColor(), image: UIImage(named: "ic_garbage_cell"), forCellHeight: 60, andFittedWidth: true, handler: nil)


dont change color of cellselected tableview

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
tableView.deselectRowAtIndexPath(indexPath, animated: true)

scale image and center it on a UIButton in Swift

update little coreData

let request = NSFetchRequest(entityName: USERDATA)
do {
user = try (coreData.managedObjectContext.executeFetchRequest(request) as! [UserData])[0]
} catch {
fatalError("Error get data from CoreData")
user.id = data.array![0].dictionary![ID]!.string!


Subscribe to Trần Mạnh Hoàng RSS