2017-05-29 3 views
-2

Ich habe eine Tabellenansicht mit 2 Zellen. Aus irgendeinem Grund werden die Zellen in der Größe verändert, wenn ich im Simulator öffne. Versuchen zu verstehen, warum. Ich habe das Bild der Ansicht hinzugefügt.Warum sind die Zellen in meiner Tabelle Größe ändern

Dies ist der Ansichtscode. denn nun wünschte, dass ich nur die Zellen in der Höhe in IB I

import UIKit 

class userMenuViewController: BaseViewController,UITableViewDataSource,UITableViewDelegate { 

var surveyNameArr = ["aaa","bbb","ccc"] 

public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int 
{ 
    return (surveyNameArr.count) 
} 

public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell 
{ 

    let cell = tableView.dequeueReusableCell(withIdentifier: "cell2", for: indexPath) as! PrefCell2TableViewCell 



    return (cell) 

} 



public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){ 

} 


override func viewDidLoad() { 
    super.viewDidLoad() 

    // Do any additional setup after loading the view. 
    addSlideMenuButton() 
} 

override func didReceiveMemoryWarning() { 
    super.didReceiveMemoryWarning() 
    // Dispose of any resources that can be recreated. 
} 


/* 
// MARK: - Navigation 

// In a storyboard-based application, you will often want to do a little preparation before navigation 
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 
    // Get the new view controller using segue.destinationViewController. 
    // Pass the selected object to the new view controller. 
} 
*/ 

} 

image of cells in table this is the image of my view

+0

mehr Einzelheiten bekannt. Wie jeder an Ihrem Screenshot sehen kann. Zeig mir, was du in Storyboard und Code gemacht hast, damit ich dir sagen kann, was du falsch gemacht hast. –

Antwort

1

das ist, was ich suchte Set erstellt zu erhalten:

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat 
{ 
    return 100.0;//Choose your custom row height 
} 
Verwandte Themen