Здесь, в случае вам нужны показатели раскрытия информации. Вы должны использовать пользовательский, чтобы перевернуть его, насколько я знаю. Я нашел эту функцию, которая будет переворачивать представление ячейки по горизонтали, но я не думаю, что это то, что вы хотите.
cell.contentView.layer.setAffineTransform(CGAffineTransformMakeScale(-1, 1))
Я бы просто сделать обе ячейки с показателями пользовательского раскрытия информации, который вы только сохранить копии индикатора раскрытия изображения перевернут, а затем при нажатии ячейки делают их поменять так:
var isFirstCell = true
var indexOfSwappingCell: Int = 0
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
isFirstCell = !isFirstCell
tableView.reloadRowsAtIndexPaths([NSIndexPath(forRow: indexOfSwappingCell, inSection: 0)], withRowAnimation: .None)
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if indexPath.row == indexOfSwappingCell {
if isFirstCell {
let cell = tableView.dequeueReusableCellWithIdentifier("customCell1", forIndexPath: indexPath) as! CustomCell1
//setup cell
return cell
} else {
let cell = tableView.dequeueReusableCellWithIdentifier("customCell2", forIndexPath: indexPath) as! CustomCell2
//setup cell
return cell
}
} else {
//setup other cells
return UITableViewCell()
}
}
в случае, если вы хотите, чтобы код, который использовал ребята, я просто побежал через него в objectivec2swift
//flip the view to flipView
@IBAction func flipButtonAction(sender: UIButton) {
UIView.transitionWithView(self.contentView, duration: 0.6, options: .TransitionFlipFromRight, animations: {() -> Void in
self.contentView.insertSubview(flipView, aboveSubview: normalView)
}, completion: {(finished: Bool) -> Void in
})
}
//flip the view back to normalView
@IBAction func flipBackButtonAction(sender: AnyObject) {
UIView.transitionWithView(self.contentView, duration: 0.6, options: .TransitionFlipFromLeft, animations: {() -> Void in
self.contentView.insertSubview(normalView, aboveSubview: flipView)
}, completion: {(finished: Bool) -> Void in
})
}
чтобы ответить на ваш комментарий
добавить эти 2 выше viewDidLoad
var isFirstLoad = true
var contentViewToFlip: UIView!
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if indexPath.row == indexOfSwappingCell {
if isFirstCell {
let cell = tableView.dequeueReusableCellWithIdentifier("customCell1", forIndexPath: indexPath) as! CustomCell1
if isFirstLoad == false {
UIView.transitionWithView(self.contentView, duration: 0.6, options: .TransitionFlipFromRight, animations: {() -> Void in
contentViewToFlip.insertSubview(cell.contentView, aboveSubview: contentViewToFlip)
}, completion: {(finished: Bool) -> Void in
})
}
isFirstLoad = false
contentViewToFlip = cell.contentView
//setup cell
return cell
} else {
let cell = tableView.dequeueReusableCellWithIdentifier("customCell2", forIndexPath: indexPath) as! CustomCell2
UIView.transitionWithView(self.contentView, duration: 0.6, options: .TransitionFlipFromLeft, animations: {() -> Void in
contentViewToFlip.insertSubview(cell.contentView, aboveSubview: contentViewToFlip)
}, completion: {(finished: Bool) -> Void in
})
contentViewToFlip = cell.contentView
//setup cell
return cell
}
} else {
//setup other cells
return UITableViewCell()
}
}
Вы пробовали делать то, что ссылка, которую вы при условии, предложенный в стрижа? Код Obj-C в этой ссылке почти идентичен в быстром. Попробуйте выполнить эти шаги, и автозаполнение в Xcode должно выполнить большую часть работы для вас. Удачи! – timgcarlson