ios - Swift - Grouped Style tableview design -


i trying design grouped style tableview in xcode 6.3. don't rectangle box covering table second image have attached below. can please tell how build screen second one?

enter image description here

enter image description here

it example ios7 here:

https://github.com/yesidi/yipprettytableviewcell


edit: made simple cell using swift.
enter image description here

// groupedtableviewcell.swift import uikit  let radius: cgfloat = 5 let insetx: cgfloat = 20  enum cellposition : int {      case top     case mid     case bottom     case topandbottom }   class groupedtableviewcell: uitableviewcell {      var cellposition: cellposition?      override func awakefromnib() {         super.awakefromnib()         // initialization code     }      override func setselected(selected: bool, animated: bool) {         super.setselected(selected, animated: animated)          // configure view selected state     }      override func drawrect(rect: cgrect) {          if self.cellposition != nil {             self.drawmask()         } else {             self.layer.mask = nil             super.drawrect(rect)         }     }      // mark: - private methods      func drawmask() {         let masklayer = cashapelayer()         masklayer.frame = cgrectinset(self.bounds, insetx, 0)          var path = cgpathcreatemutable()          let minx = cgrectgetminx(masklayer.bounds)         let midx = cgrectgetmidx(masklayer.bounds)         let maxx = cgrectgetmaxx(masklayer.bounds)         let miny = cgrectgetminy(masklayer.bounds)         let midy = cgrectgetmidy(masklayer.bounds)         let maxy = cgrectgetmaxy(masklayer.bounds)          if let cellposition = self.cellposition {             switch cellposition {             case .top:                 cgpathmovetopoint(path, nil, minx, maxy)                 cgpathaddarctopoint(path, nil, minx, miny, midx, miny, radius)                 cgpathaddarctopoint(path, nil, maxx, miny, maxx, maxy, radius)                 cgpathaddlinetopoint(path, nil, maxx, maxy)                 cgpathclosesubpath(path)             case .mid:                 cgpathaddrect(path, nil, masklayer.bounds)             case .bottom:                 cgpathmovetopoint(path, nil, minx, miny)                 cgpathaddarctopoint(path, nil, minx, maxy, midx, maxy, radius)                 cgpathaddarctopoint(path, nil, maxx, maxy, maxx, miny, radius)                 cgpathaddlinetopoint(path, nil, maxx, miny)                 cgpathclosesubpath(path)             case .topandbottom:                 cgpathmovetopoint(path, nil, minx, midy)                 cgpathaddarctopoint(path, nil, minx, maxy, midx, maxy, radius)                 cgpathaddarctopoint(path, nil, maxx, maxy, maxx, midy, radius)                 cgpathaddlinetopoint(path, nil, maxx, midy)                 cgpathaddarctopoint(path, nil, maxx, miny, midx, miny, radius)                 cgpathaddarctopoint(path, nil, minx, miny, minx, midy, radius)                 cgpathclosesubpath(path)             }         }          masklayer.path = path         masklayer.fillcolor = uicolor.redcolor().cgcolor         masklayer.backgroundcolor = uicolor.clearcolor().cgcolor         self.layer.mask = masklayer      } } 

now can set cell's position:

// tableviewcontroller.swift // mark: - table view data source override func tableview(tableview: uitableview, willdisplaycell cell: uitableviewcell, forrowatindexpath indexpath: nsindexpath) {     assert(cell.iskindofclass(groupedtableviewcell.self), "")      let groupedcell = cell as! groupedtableviewcell      let numberofrows = tableview.numberofrowsinsection(indexpath.section) - 1      groupedcell.cellposition = (indexpath.row == numberofrows && indexpath.row == 0) ? .topandbottom : ((indexpath.row == 0) ? .top : (indexpath.row == numberofrows ? .bottom : .mid)) } 

i hope helps you!


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -