1

XCode 4.2 で iPhone 用のアプリをプログラミングしたいと考えています。このアプリの機能を切り替えるには、タブバーを使用します。「状況」が必要です: 1 つの「状況」はタブバーにログインし、2 番目の「状況」はログイン タブバーです。したがって、2 つのアイデアが頭に浮かびます。2 つのストーリーボードを使用してストーリーボードを動的に使用するか、1 つのストーリーボードのみを使用して 2 つのシーン (ログインとログイン) を使用し、viewcontroller を動的に割り当てます。しかし、これをどのようにプログラムできるかわかりません.. 私がしなければならないことはどういう意味ですか? どうすればこれを行うことができますか?

ご回答ありがとうございます :)

4

1 に答える 1

0

これを試してください。お役に立てば幸いです。

<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Trainning.animation"
x:Name="Window"
Title="animation"
Width="640" Height="480">
<Window.Resources>
    <Storyboard x:Key="one_in_all">
        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="btn_animation_1">
            <EasingColorKeyFrame KeyTime="0" Value="#FFF0F0EA"/>
            <EasingColorKeyFrame KeyTime="0:0:0.2" Value="#FF038529"/>
            <EasingColorKeyFrame KeyTime="0:0:0.4" Value="#FFF0F0EA"/>
        </ColorAnimationUsingKeyFrames>
    </Storyboard>
</Window.Resources>

<Grid x:Name="LayoutRoot">
    <Button x:Name="btn_animation_1" Content="Animation1" HorizontalAlignment="Left" Height="54" Margin="187,133,0,0" VerticalAlignment="Top" Width="64" Click="btn_animation_1_Click" />
    <Button x:Name="btn_animation_2" Content="Animation2" Height="54" Margin="310,133,258,0" VerticalAlignment="Top" Click="btn_animation_2_Click" />
</Grid>

コードビハインドで

using System.Windows.Media.Animation;

public partial class animation : Window
{
    string Name;
    public animation()
    {
        this.InitializeComponent();

        // Insert code required on object creation below this point.
    }

    private void btn_animation_1_Click(object sender, RoutedEventArgs e)
    {
        Button button = (Button)sender;
        Name = button.Name;
        Animation_In_All();
    }

    public void Animation_In_All()
    {
        Storyboard SB = (Storyboard)(FindResource("one_in_all"));
        Storyboard.SetTargetName(SB.Children[0], Name);           
        SB.Begin();
    }

    private void btn_animation_2_Click(object sender, RoutedEventArgs e)
    {
        Button button = (Button)sender;
        Name = button.Name;
        Animation_In_All();
    }
}
于 2012-06-04T13:52:46.843 に答える