我在 iPhone 视图上有一个基于单声道触控的按钮。当它被点击时,它会触发一个动画,然后返回到主动画。两个动画都在 UIImageView 上触发,该 UIImageView 位于按钮所在的同一视图上。
但是当我点击两次后它消失了?我希望按钮始终在表面上。
partial void TurnLightOnOrOff (MonoTouch.Foundation.NSObject sender)
{
TAMAM.coreLife.SwitchLightsStatus ();
dayPartType = DayPart.CurrentDayPart ();
if (dayPartType != DayPart.DayPartType.Night) {
playMainAnim ();
return;
}
var sound = SystemSound.FromFile (@"sound/Click.caf");
sound.PlaySystemSound ();
if (!TAMAM.coreLife.LightsOn) {
myImages = new List<UIImage> ();
myImages.Add (UIImage.FromFile (@"image/babysleep/babysleeplightoff10000.png"));
myImages.Add (UIImage.FromFile (@"image/babysleep/babysleeplightoff20000.png"));
myImages.Add (UIImage.FromFile (@"image/babysleep/babysleeplightoff30000.png"));
var myAnimatedView = new UIImageView (this.animFrameRectangle);
myAnimatedView.AnimationImages = myImages.ToArray ();
myAnimatedView.AnimationDuration = 1; // Seconds
myAnimatedView.AnimationRepeatCount = 0; // 0 = Loops Forever
myAnimatedView.StartAnimating ();
if (this.svBabyAge.Subviews.Length > 0) {
this.svBabyAge.Subviews [0].RemoveFromSuperview ();
}
if(this.ivBabyAge.Subviews.Length > 0)
{
this.ivBabyAge.Subviews [0].RemoveFromSuperview ();
}
this.ivBabyAge.AddSubview (myAnimatedView);
this.svBabyAge.AddSubview (this.ivBabyAge);
} else {
playMainAnim ();
}
}
{
[Register ("babyAge")]
partial class babyAge
{
[Outlet]
MonoTouch.UIKit.UIView svBabyAge { get; set; }
[Outlet]
MonoTouch.UIKit.UIImageView ivBabyAge { get; set; }
[Outlet]
MonoTouch.UIKit.UIButton butonInformation { get; set; }
[Action ("ShowInformationAboutTamagotchiStatus:")]
partial void ShowInformationAboutTamagotchiStatus (MonoTouch.Foundation.NSObject sender);
[Action ("FeedBaby:")]
partial void FeedBaby (MonoTouch.Foundation.NSObject sender);
[Action ("PlayWithBaby:")]
partial void PlayWithBaby (MonoTouch.Foundation.NSObject sender);
[Action ("TurnLightOnOrOff:")]
partial void TurnLightOnOrOff (MonoTouch.Foundation.NSObject sender);
[Action ("Dance:")]
partial void Dance (MonoTouch.Foundation.NSObject sender);
[Action ("DoctorRepairBaby:")]
partial void DoctorRepairBaby (MonoTouch.Foundation.NSObject sender);
[Action ("DoWc:")]
partial void DoWc (MonoTouch.Foundation.NSObject sender);
void ReleaseDesignerOutlets ()
{
if (svBabyAge != null) {
svBabyAge.Dispose ();
svBabyAge = null;
}
if (ivBabyAge != null) {
ivBabyAge.Dispose ();
ivBabyAge = null;
}
if (butonInformation != null) {
butonInformation.Dispose ();
butonInformation = null;
}
}
}
}