2016-03-30 22 views
1

bu burada enter image description hereÖzel koleksiyon görünümü nasıl programlanır? Projemde

kare gibi SVGKImageView & UILabel ile programlama yoluyla özel Hücreyi tasarlamak istediğiniz bir SVGKImageView & olan "Dadar" bir UILabel olduğunu.

Ama şimdi bu

enter image description here

gibi çıktı alıyorum Bu öğeler eklemek bir ImageView ve tasarım gibi bir etiket içeren özel bir görünüm oluşturmanız gerekir kodum

func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell 
{ 
    // intialize collection cell with media collection cell 
    let cell = collectionView.dequeueReusableCellWithReuseIdentifier("mediaCell", forIndexPath: indexPath) as! ViewContentMediaCollectionCell 

    // get the data from view model 
    let viewModelobj = mViewContentViewModelObj!.getViewContentData() 

    // set the page imageview frame with default size 
    var mSVGImageView = SVGKFastImageView(frame: CGRect(x: 0, y: 0, width: cell.frame.width, height: (50))) 

    // set the pageImageview with actual pageImage 
    mSVGImageView = SVGKFastImageView(SVGKImage: viewModelobj[indexPath.row].mContentPage) 

    // add page imageview in the cell 
    cell.contentView.addSubview(mSVGImageView) 

    // add the title label 
    let titleLabel : UILabel = UILabel(frame: CGRect(x: 0, y: cell.frame.height - 20, width: cell.frame.width, height: 20)) 

    // set the page title 
    titleLabel.text = viewModelobj[indexPath.row].mPageTitle 

    // add title label to the collection view cell 
    cell.contentView.addSubview(titleLabel) 

    // return the cell 
    return cell 

    } 
+0

kısıtlamaları –

+0

nope ... özel görüntüleme hücresinde değil –

cevap

0

olduğunu contentView

+0

B kısıtlamaları kullanıyor musunuz? ut ImageView içinde görüntüleyemiyorum. Bu yüzden programlı olarak svgkimageview oluşturuyorum. –

İlgili konular