簡體   English   中英

如何像在iPhone的地圖應用程序中一樣在Monotouch iPhone中創建折疊地圖

[英]How to create a folded map in monotouch iPhone like what is in map application of iPhone

這是iPhone地圖應用程序的屏幕截圖:

在此處輸入圖片說明

我們如何在應用程序中實現shuch頁面。 我是iPhone和Monotouch上的新手,不知道這是提供可折疊性的組件還是MKMapView上的功能? 也許這是一個自定義代碼! 有什么機構可以幫助我嗎?

使用此代碼段即可完成工作。

[UIView transitionWithView:urImage 
    duration:1.5 
    options: UIViewAnimationOptionTransitionCurlUp 
    animations^{
        urImage.frame = requiredFrame;
    } 
    completion:^(BOOL finished){
        //[urImage removeFromSuperview];
        // do something after animation has completed
    }
   ];

您可以試玩一下,然后將其插入到需要的地方。

她是uiview動畫的蘋果文檔鏈接:

http://developer.apple.com/library/ios/ipad/#documentation/UIKit/Reference/UIView_Class/UIView/UIView.html

編輯:

這是一組代碼,可以為您帶來相同的效果:只需正確地掛起不作為。 它僅使用幾個按鈕即可卷曲和卷曲,因此您應該能夠做到。 只需創建一個單一視圖應用程序,然后在視圖中放置兩個按鈕,然后將操作連接到右側按鈕即可。

.h文件的代碼:

@interface FirstViewController : UIViewController {

IBOutlet UIView *viewSecond;
IBOutlet UIView *viewFirst;   
}

- (IBAction)btnSecondView_Clicked:(id)sender;
- (IBAction)btnFirstView_Clicked:(id)sender;

@end

.m文件的代碼:

 #import "FirstViewController.h"

@implementation FirstViewController

- (void)viewDidLoad {
[super viewDidLoad];
}

- (void)btnSecondView_Clicked:(id)sender {

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:2.0];
[viewSecond setAlpha:0.0];
[viewFirst setAlpha:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:viewSecond cache:YES];
[UIView commitAnimations];   
}

- (IBAction)btnFirstView_Clicked:(id)sender {

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:2.0];
[viewFirst setAlpha:0.0];   
[viewSecond setAlpha:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:viewFirst cache:YES];
[UIView commitAnimations];
}

- (void)didReceiveMemoryWarning {

[super didReceiveMemoryWarning];

}


- (void)dealloc {
[super dealloc];
}


@end

希望這會幫助您開展業務。

快樂的編碼。:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM