小编Jos*_*ork的帖子

iOS - 自定义表格单元格不是UITableView的全宽度

我可能会犯这个错误.所以我创建了一个UITableView,它基本上有一个自动布局尾随空间设置为主视图.我正在为这个表创建一个自定义单元格,所以我在原型单元格上进行定制,定制它,并为它创建我的类.这一切都很好.

我似乎无法解决的是自定义单元格不是实际表格单元格的整个宽度,因此只显示白色背景.如果我不使用自定义单元格,则可以使用整个宽度表单元格.

我为单元格内容设置了约束,以便背景图像填充单元格.

我究竟做错了什么?让我知道您需要帮助解决这个问题.

ProfileCustomCell.h

#import <UIKit/UIKit.h>

@interface ProfileCustomCell : UITableViewCell {

}

@property (nonatomic, strong) IBOutlet UILabel *nameLabel;
@property (nonatomic, strong) IBOutlet UIImageView *profileImageView;

@end
Run Code Online (Sandbox Code Playgroud)

ProfileCustomCell.m

#import "ProfileCustomCell.h"

@implementation ProfileCustomCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];

    if (self) {
        self.nameLabel.text = nil;
    }

    return self;

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
Run Code Online (Sandbox Code Playgroud)

UITableView的

[tableView registerNib:[UINib nibWithNibName:@"ProfileCustomCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"Cell"];

[tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

ProfileCustomCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];

cell.nameLabel.text = [NSString stringWithFormat:@"%@", [child objectForKey:@"first_name"]]; …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview ios autolayout

8
推荐指数
1
解决办法
1万
查看次数

自定义表盘时 watchOS 并发症未显示为选项

这是我尝试添加的第一个复杂功能。我正在将它添加到当前项目中。我设法让它出现在模拟器中,但没有出现在我的实际手表上。这只是一个 SimpleImage 并发症,所以我有点不知所措,而且我在网上没有找到太多关于这个问题的信息。

它显示在复杂性下,但不是自定义表盘时的选项。

这是我的代码如下:

- (void)getSupportedTimeTravelDirectionsForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTimeTravelDirections directions))handler {
    //handler(nil);
    handler(CLKComplicationTimeTravelDirectionForward|CLKComplicationTimeTravelDirectionBackward);
}

- (void)getTimelineStartDateForComplication:(CLKComplication *)complication withHandler:(void(^)(NSDate * __nullable date))handler {
    handler(nil);
}

- (void)getTimelineEndDateForComplication:(CLKComplication *)complication withHandler:(void(^)(NSDate * __nullable date))handler {
    handler(nil);
}

- (void)getPrivacyBehaviorForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationPrivacyBehavior privacyBehavior))handler {
    handler(CLKComplicationPrivacyBehaviorShowOnLockScreen);
}

#pragma mark - Timeline Population

- (void)getCurrentTimelineEntryForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTimelineEntry * __nullable))handler {
    // Call the handler with the current timeline entry
    handler(nil);
}

- (void)getTimelineEntriesForComplication:(CLKComplication *)complication beforeDate:(NSDate *)date limit:(NSUInteger)limit withHandler:(void(^)(NSArray<CLKComplicationTimelineEntry *> * __nullable entries))handler {
    // Call the …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c apple-watch watchkit

2
推荐指数
1
解决办法
1319
查看次数

使用codeigniter上传.amr

我一直试图将.arm上传到一个内置于codeigniter的网站.我知道它不是默认的我的类型所以我添加了它:

'amr'   =>  'audio/amr',
Run Code Online (Sandbox Code Playgroud)

但它似乎并没有与之合作.我还将它添加到允许的类型中.是否可以支持amr,如果是的话,我可能做错了什么?

php upload codeigniter amr

1
推荐指数
1
解决办法
3743
查看次数