0
기본 tableview 셀을 사용하여 create tableview를 시도합니다. 각 셀에는 imageView와 title이 있습니다. 이미지가 서버에서 비동기 적으로로드되었습니다. 이 목적을 위해 Alamofire 프레임 워크를 사용합니다.신속한 선택 후 UITableViewCell 잘못된 레이아웃
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let CellID: NSString = "Cell"
let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: CellID)
cell.textLabel!.text = "test #\(indexPath.row)"
var imageURL = repArray[indexPath.row]["image"]!!
cell.imageView!.image = UIImage(named: "recept")
Alamofire.request(.GET, imageURL).response() {
(_, _, data, _) in
let image = UIImage(data: data! as NSData)
dispatch_async(dispatch_get_main_queue(), {
if let cellToUpdate = tableView.cellForRowAtIndexPath(indexPath) {
cellToUpdate.imageView!.image = image
}
})
}
return cell
}
그러나 임의의 tableview 셀을 선택하면 이미지 뷰의 크기가 변경됩니다.
가 발생하는 이유는 무엇입니까?
아니요, 아닙니다. –
문제가 해결 되었습니까? 나는 똑같은 문제를 치고있다. – user3204765