ios - Tableview's contentView smaller than tableview frame and cell -
i'm creating tableview programatically following code:
override func viewdidlayoutsubviews() { //@begin store selection - settings self.tbstores = uitableview(frame: cgrect(x: 15, y: 60, width: uiscreen.main.bounds.size.width - 30, height: 150)) self.tbstores.register(uitableviewcell.self, forcellreuseidentifier: "cell") tbstores.backgroundcolor = uicolor.white tbstores.delegate = self tbstores.datasource = self tbstores.allowsselection = true; tbstores.translatesautoresizingmaskintoconstraints = true }
and adding in viewautocomplete created programatically too
if (viewautocomplete == nil) { self.viewautocomplete = uiview(frame: cgrect(x: 0, y: 0, width: uiscreen.main.bounds.size.width, height: uiscreen.main.bounds.size.height)) viewautocomplete.backgroundcolor = uicolor(red: 32 / 255.0, green: 48 / 255.0, blue: 90 / 255.0, alpha: 1) viewautocomplete.alpha = 1 viewautocomplete.translatesautoresizingmaskintoconstraints = true self.viewautocomplete.tag = 123 self.view!.addsubview(viewautocomplete) viewautocomplete.addsubview(tbstores) }
the problem contentview smaller cell , tableview following screenshots
i solved problem following
ios 8 uitableview separator inset 0 not working instructions separator insets
i added following code viewdidlayoutsubviews
tbstores.celllayoutmarginsfollowreadablewidth = false;
Comments
Post a Comment