mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-02 09:31:32 +08:00
* Factored out display of alerts into RKAlert interface that hides the differences between UIKit and OS X Cocoa. * Added macosx to supported platforms to enable build on OS X. * Configured project to use conditional architectures to enable building on OS X and iOS from the same targets. * Implemented a bare-bones OS X example app. * Create `rake build` task for building RestKit against iOS and OS X SDK for quick testing.
39 lines
1.0 KiB
Objective-C
39 lines
1.0 KiB
Objective-C
//
|
|
// RKAlert.m
|
|
// RestKit
|
|
//
|
|
// Created by Blake Watters on 4/10/11.
|
|
// Copyright 2011 Two Toasters. All rights reserved.
|
|
//
|
|
|
|
#if TARGET_OS_IPHONE
|
|
#import <UIKit/UIKit.h>
|
|
#else
|
|
#import <AppKit/AppKit.h>
|
|
#endif
|
|
|
|
#import "RKAlert.h"
|
|
|
|
void RKAlert(NSString* message) {
|
|
RKAlertWithTitle(message, @"Alert");
|
|
}
|
|
|
|
void RKAlertWithTitle(NSString* message, NSString* title) {
|
|
#if TARGET_OS_IPHONE
|
|
UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:title
|
|
message:message
|
|
delegate:nil
|
|
cancelButtonTitle:NSLocalizedString(@"OK", nil)
|
|
otherButtonTitles:nil];
|
|
[alertView show];
|
|
[alertView release];
|
|
#else
|
|
NSAlert *alert = [[NSAlert alloc] init];
|
|
[alert setMessageText:message];
|
|
[alert setInformativeText:message];
|
|
[alert addButtonWithTitle:NSLocalizedString(@"OK", nil)];
|
|
[alert runModal];
|
|
[alert release];
|
|
#endif
|
|
}
|