我的转换看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<transition xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/divider"/>
<item android:drawable="@drawable/divider_active"/>
</transition>
Run Code Online (Sandbox Code Playgroud)
和代码看起来像这样:
View divider = v.findViewById(R.id.divider);
if (divider != null) {
TransitionDrawable transition = (TransitionDrawable) divider.getBackground();
transition.startTransition(2000);
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,我不知道如何永远重复这种转变,所以我可以创造一个脉冲效果.
编辑:
为了清楚起见:在创建视图(listitem)时执行代码,因此循环不是解决方案.
如果我的iPhone应用程序(非通用)在我的iPad(第3代)上以横向模式启动,则在按下1x/2x按钮或更改方向之前,它不响应任何触摸.之后它正常工作.如果我在横向模式的iPhone 5上启动它,它就像一个魅力.
shouldAutorotateToInterfaceOrientation在每个View中都给出YES,所以我认为这不是问题所在.
第一个视图是标签栏视图.
我今天将我的XCode从6.2更新到6.3.我适应一切变化迅速,但是当我运行应用程序,我为每一个NIB错误,我尝试加载具有~ipad
或~iphone
.(无法加载NIB)
没有那个设备修改器的笔尖像往常一样加载.如果我删除了~iphone
或者~ipad
,可以再次找到笔尖,但显然没有解决方案,因为它是一个通用应用程序.
每个其他文件类型也是如此,我尝试通过代码加载,例如故事板.
我试着将这个obj-c代码翻译成swift代码:
NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat: 44100.0], AVSampleRateKey,
[NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey,
[NSNumber numberWithInt: 2], AVNumberOfChannelsKey,
[NSNumber numberWithInt: AVAudioQualityMax], AVEncoderAudioQualityKey,
nil];
Run Code Online (Sandbox Code Playgroud)
//很快
var settings = [NSNumber.numberWithFloat(Float(44100.0)): AVSampleRateKey,
NSNumber.numberWithInt(Int32(kAudioFormatAppleLossless)): AVFormatIDKey,
NSNumber.numberWithInt(2): AVNumberOfChannelsKey,
NSNumber.numberWithInt(Int32(AVAudioQuality.Max)): AVEncoderAudioQualityKey];
Run Code Online (Sandbox Code Playgroud)
但我收到错误:Type()不符合协议'FloatLiteralConvertible'
有人知道如何纠正这个问题吗?谢谢
ios ×2
iphone ×2
android ×1
dictionary ×1
ios8 ×1
ipad ×1
orientation ×1
swift ×1
touch ×1
transition ×1
xcode ×1
xcode6.3 ×1
xib ×1