我尝试用编程方式使用不同颜色的文本设置UILabel,
NSMutableAttributedString * string = [[NSMutableAttributedString alloc] initWithString:@"firstsecondthird"];
[string addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0,5)];
[string addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:NSMakeRange(5,6)];
[string addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:NSMakeRange(11,5)];
[self.resultLabel setAttributedText:string];
Run Code Online (Sandbox Code Playgroud)
我得到了我的预期.但是,我有兴趣在story.storyboard中的storyboard中完成所有这些工作.任何人都可以帮我这样做.
这就是我要的,
我尝试将cornerRadius添加到UILabel使用User Defined Runtime Attributes
但是它没有按预期工作,cornerRadius没有设置,我想知道我犯了什么错误.我附上了它的截图,
帮助我解决问题
我是 iOS 应用程序开发领域的新手。我正在尝试使用AVFoundation捕获视频。我在这方面很成功。但是当我尝试使用MPMoviePlayerController播放视频时,我遇到了太多问题。所以我尝试使用AVPlayer来玩。但在AVPlayer中有两种方法AVPlayerLayer和AVPlayerViewController。我尝试搜索这些内容,但没有任何特别的理由来选择其中之一。谁能建议我哪个更好用?
我正在播放由AVCapture录制的录制视频.我将视频URL保存在名为outputFileURL的字符串中.我尝试使用AVPlayerLayer概念播放视频.我用的代码是
AVPlayer *avPlayerq = [AVPlayer playerWithURL:outputFileURL];
avPlayerq.actionAtItemEnd = AVPlayerActionAtItemEndNone;
AVPlayerLayer *videoLayer = [AVPlayerLayer playerLayerWithPlayer:avPlayerq];
videoLayer.frame= self.view.bounds;
[self.view.layer addSublayer:videoLayer];
[avPlayerq play];
Run Code Online (Sandbox Code Playgroud)
但我得到的视频不是全屏.任何人都可以帮我解决?