ios – CollectionView窗口保持黑色

ios – CollectionView窗口保持黑色,第1张

概述我正在写iOS应用程序.我有CollectionView窗口,里面有一个通过拖放添加的customCell.当我运行应用程序时,CollectionView窗口的一部分是黑色的. 集合可重用视图标识符设置为“ItemCell”.自定义视图单元格设置为“CustomViewCell”类. CollectionView的dataSource和delegate已设置为FirstViewControlle 我正在写iOS应用程序.我有CollectionVIEw窗口,里面有一个通过拖放添加的customCell.当我运行应用程序时,CollectionVIEw窗口的一部分是黑色的.
集合可重用视图标识符设置为“ItemCell”.自定义视图单元格设置为“CustomVIEwCell”类. CollectionVIEw的dataSource和delegate已设置为FirstVIEwController.
那是代码:

FirstVIEwcontroller:#import <UIKit/UIKit.h>#import "CustomVIEwCell.h"@interface FirstVIEwController : UIVIEwController<UICollectionVIEwDataSource,UICollectionVIEwDelegate>@property (weak,nonatomic) IBOutlet UITextFIEld *txtFIEld;- (IBAction)slIDeRed:(ID)sender;- (IBAction)slIDeGreen:(ID)sender;- (IBAction)slIDeBlue:(ID)sender;- (IBAction)btnAdd:(ID)sender;@end

.m文件:

#import "FirstVIEwController.h"@interface FirstVIEwController ()@end@implementation FirstVIEwController- (voID)vIEwDIDLoad{    [super vIEwDIDLoad];    // Do any additional setup after loading the vIEw,typically from a nib.}-(voID)vIEwDIDAppear:(BOol)animated{}- (voID)dIDReceiveMemoryWarning{    [super dIDReceiveMemoryWarning];    // dispose of any resources that can be recreated.}-(NSInteger)numberOfSectionsInCollectionVIEw:(UICollectionVIEw *)collectionVIEw{    return 10;}-(NSInteger)collectionVIEw:(UICollectionVIEw *)collectionVIEw numberOfItemsInSection:(NSInteger)section{    return 5;}-(UICollectionVIEwCell *)collectionVIEw:(UICollectionVIEw *)collectionVIEw cellForItemAtIndexPath:(NSIndexPath *)indexPath{    CustomVIEwCell *cell = [collectionVIEw dequeueReusableCellWithReuseIDentifIEr:@"ItemCell" forIndexPath:indexPath];    if (cell == nil) {        cell = [[CustomVIEwCell alloc]init];    }    cell.label.text = @"KitKat";    //cell.lblMain.textcolor = [UIcolor whitecolor];    // cell.backgroundcolor = [UIcolor blackcolor];    return cell;}- (IBAction)slIDeRed:(ID)sender {}- (IBAction)slIDeGreen:(ID)sender {}- (IBAction)slIDeBlue:(ID)sender {}- (IBAction)btnAdd:(ID)sender {}@end

CustomVIEwCell:

#import "CustomVIEwCell.h"@implementation CustomVIEwCell@synthesize label;- (ID)initWithFrame:(CGRect)frame{    self = [super initWithFrame:frame];    if (self) {        // Initialization code    }    return self;}@end

如何强制该collectionVIEw窗口显示带有标签的customCell.然而它只是黑色的窗户.
最好的祝福

解决方法 无法使默认透明度起作用.但是解决方法解决了这个问题. 1.选择collectionVIEw. 2.单击“背景”属性添加颜色. 3.选择颜色(在我的情况下为“白色”) 4.将颜色“不透明度”设置为“0%” 你有一个透明的背景. 总结

以上是内存溢出为你收集整理的ios – CollectionView窗口保持黑色全部内容,希望文章能够帮你解决ios – CollectionView窗口保持黑色所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1038600.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-24
下一篇2022-05-24

发表评论

登录后才能评论

评论列表(0条)

    保存