草庐IT

AVPlayer-Swift

全部标签

ios - Swift,自定义 UIButton 单击时不起作用

我有一个用xib文件创建的自定义UIButton。当我在我的View上使用我的自定义按钮时,当我按下它时它不起作用。我的RoundBtn.swift文件:importUIKit@IBDesignableclassRoundBtn:UIButton{varnibName="RoundBtn"@IBOutletweakvarbtnImageView:UIImageView!@IBOutletweakvarbtnLabel:UILabel!@IBInspectablevarimage:UIImage?{get{returnbtnImageView.image}set(image){btnIm

ios - 如何在 Swift 中以编程方式更改 UIButton 状态

我开发了在屏幕上绘图的应用程序。我有带有一堆按钮的工具面板。其中一些必须根据当前用户操作而被禁用或按下。考虑到“状态”属性是只读的,我如何以编程方式更改按钮的UIControlState?如果不可能,有什么替代方案可以达到此目的? 最佳答案 我觉得你很困惑。UIControlState用于设置目标/操作,或更改特定状态下按钮的外观(因此,例如,您可以指定选中时使用的图像,以及不同的图像当按钮不处于选中状态时。)如果你想改变状态为selected,你只要设置selected属性即可。button.isSelected=true同样适用

ios - Swift 3 核心数据 "Entity"错误 : `Use of undeclared type`

Useofundeclaredtype'Transcription'我正在学习Swift3中核心数据的简单教程(https://learnappdevelopment.com/uncategorized/how-to-use-core-data-in-ios-10-swift-3/)我在行中收到上述错误:letfetchRequest:NSFetchRequest=Transcription.fetchRequest()我仔细检查了实体“Transcription”在我的.xcdatamodeld文件中拼写正确本教程是为Swift3设计的,但自发布以来我修复了另一个变化,所以我猜测过去

ios - 在 ios 中使用 swift 删除文件

funcgetDocumentsDirectory()->URL{letpaths=FileManager.default.urls(for:.documentDirectory,in:.userDomainMask)letdocumentsDirectory=paths[0]returndocumentsDirectory}很简单,我使用该函数获取我的文件名。它现在正确返回,我如何使用Swift3删除该文件?以及如何像UIImageJPEGRepresentation一样读回图像?letimage_data=UIImageJPEGRepresentation(self.commons

iphone - 无法删除或停止 AVPlayer

我有一个AVPlayer,每当单击链接时我都会将其加载到新View中。-(void)createAndConfigurePlayerWithURL:(NSURL*)movieURLsourceType:(MPMovieSourceType)sourceType{self.playerItem=[AVPlayerItemplayerItemWithURL:movieURL];customControlOverlay=[[AFDetailViewControlleralloc]initWithNibName:@"AFMovieScrubControl"bundle:nil];backgro

IOS AVPlayer 不会播放视频

我正在尝试使用so播放视频,我从教程中获得了一些代码,但它不起作用。这是我使用的代码:-(void)viewDidAppear:(BOOL)animated{avAsset=[AVAssetassetWithURL:[NSURLURLWithString:filePath]];avPlayerItem=[avPlayerIteminitWithAsset:avAsset];avPlayer=[AVPlayerplayerWithPlayerItem:avPlayerItem];avPlayerLayer=[AVPlayerLayerplayerLayerWithPlayer:avPla

ios - 在 UISwipeActionsConfiguration iOS 11 中更改文本和图像的颜色 - Xamarin/Swift

我有这个适用于iOS11的UISwipeActionsConfiguration这个代码看起来像publicoverrideUISwipeActionsConfigurationGetLeadingSwipeActionsConfiguration(UITableViewtableView,NSIndexPathindexPath){vardefinitionAction=ContextualDefinitionAction(indexPath.Row);varflagAction=ContextualFlagAction(indexPath.Row);varleadingSwipe=

iphone - iOS 音频可视化使用 AVPlayer

我正在尝试对流进行音频可视化。音频必须在后台播放,目前我正在使用AVPlayer播放它,但我无法从中获取计量。我如何获得计量并进行可视化?有什么建议吗? 最佳答案 这里有一个波形示例:Acocoaaudioplayercomponentwhichdisplaysthewaveformoftheaudiofile这里有一个LEDbargauge另一个例子如何使用:ATTabandHoldAudioRecord苹果,也有SpeakHere示例-代码包含一个LevelView..但是这个Apple示例代码实现起来并不简单......

ios - swift : Play a Facebook Video using an AVPlayer

我需要为我的iOS应用播放来自多个视频源(Facebook和Instagram)的视频。我使用视频URL创建了一个AVPlayerItem,它适用于Instagram,但不适用于facebook。网址布局如下:Instagram:https://scontent.cdninstagram.com/t50.2886-16/xxx.mp4Facebook:https://www.facebook.com/video/embed?video_id=xxx有没有办法在AVPlayer中播放Facebook视频,还是应该使用UIWebview? 最佳答案

ios - 使用 AVQueuePlayer/AVPlayer 进行无缝播放 - 这可能吗?

我一直在研究AVPlayer及其子类AVQueuePlayer(以及一组MPMediaItem),发现后者在无间隙专辑中表现更好,但似乎都没有完全完成任务。当使用AVPlayer的replaceCurrentItemWithPlayerItem方法时,当前轨道和下一轨道之间有一个非常明显的停顿。但是使用AVQueuePlayer的advanceToNextItem方法,差距要小得多。唯一的选择是这两个类,因为我正在处理AVPlayerItem,其中包含iTunes音乐库中项目的AssetsURL。这就引出了一个问题,是否可以使用iOSSDK实现无缝播放? 最