1
응용 프로그램의 "친구"탭으로 전환 할 때 검정색 화면에 문제가 있습니다. 이것은 내 friendsviewcontroller 때문에 발생합니다. 내가 viewcontroller에 대한 링크를 제거하고 정상적인 화면을 보여 주었기 때문에 나는 이것을 안다. 누군가가 내가 잘못탭 표시 줄을 선택하면 검은 색 화면이 나타납니다.
FriendsViewController을 한 일을 볼 수 있기를 바랍니다 : ronatory에서 알 수 있듯이
import UIKit
import FBSDKLoginKit
class FriendsViewController: UITabBarController, UITableViewDelegate,UITableViewDataSource{
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var friendTypeSwitch: UISegmentedControl!
@IBOutlet weak var friendSearchBar: UITextField!
var user:User = User()
override func viewDidLoad() {
super.viewDidLoad()
print("Friends tab")
// Do any additional setup after loading the view.
}
override func viewDidAppear(_ animated: Bool) {
print("view did appear")
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 30
}
//What to do with tableview
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = self.tableView.dequeueReusableCell(withIdentifier: "friendCell", for: indexPath) as! friendsCustomCell
user.username = "kulgut123"
cell.friendName.text = user.username
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}
func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableViewAutomaticDimension
}
}
class friendsCustomCell: UITableViewCell{
@IBOutlet weak var friendImg: UIImageView!
@IBOutlet weak var friendName: UILabel!
}
'FriendsViewController'를 해당 탭에 연결하는 방법에 대한 정보를 제공 할 수 있습니까? – nshuman
'UITabBarController'에서 서브 클래스를 작성 했으므로 문제가 있다고 생각합니다. 나는 당신이'UIViewController'에서 하위 클래스로 만들고 싶다고 생각합니다. – ronatory
예, tabView 컨트롤러의 노란색 사각형에서 CtrlView를 friendView로 직접 드래그하여 연결했습니다. 아마 그것을 구현하는 더 좋은 방법이 있을까요? – Pr0tonion