This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIBarButtonItem* advanceButton = [[[UIBarButtonItem alloc] | |
initWithBarButtonSystemItem:UIBarButtonSystemItemAction | |
target:self action:@selector(action:)] autorelease]; | |
self.navigationItem.rightBarButtonItem = advanceButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark - | |
#pragma mark UIActionSheetDelegate method | |
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex: | |
(NSInteger)buttonIndex | |
{ | |
[actionSheet release]; | |
NSLog(@"User Pressed Button %d\n", buttonIndex + 1); | |
} | |
-(void)action: (UIBarButtonItem *) item |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (MKAnnotationView *)mapView:(MKMapView *)theMapView | |
viewForAnnotation:(id <MKAnnotation>)annotation | |
{ | |
// try to dequeue an existing pin view first | |
static NSString* ItemAnnotationIdentifier = @"itemAnnotationIdentifier"; | |
MKPinAnnotationView* pinView = (MKPinAnnotationView *) | |
[_mapView dequeueReusableAnnotationViewWithIdentifier: | |
ItemAnnotationIdentifier]; | |
if (!pinView) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player | |
@started_to_rest = false | |
@user_turn = false | |
$health_min_live = 10 | |
$health_max_live = 15 | |
def play_turn(warrior) | |
# add your code here | |
@user_turn = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <MapKit/MapKit.h> | |
#import <CoreLocation/CoreLocation.h> | |
@interface CTLocationManager : NSObject <CLLocationManagerDelegate, | |
MKReverseGeocoderDelegate> { | |
// instand variables | |
} | |
// Other methods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Make sure the user has moved, | |
// the reverse geocoder time is over a minute, | |
// or is the first time ask | |
if (isMoved | |
|| [self.lastReverseGeocoderTime timeIntervalSinceNow] < -60 | |
|| !self.lastReverseGeocoderTime) { | |
// Start to ask the reverse geocoder service | |
self.reverseGeocoder = [[[MKReverseGeocoder alloc] initWithCoordinate: | |
self.currentLocation.coordinate] autorelease]; | |
self.reverseGeocoder.delegate = self; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder | |
didFailWithError:(NSError *)error | |
{ | |
// Do something | |
} | |
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder | |
didFindPlacemark:(MKPlacemark *)placemark | |
{ | |
self.placeName = placemark.thoroughfare; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface MyViewController : UIViewController <UIAlertViewDelegate> | |
{ | |
UIAlertView *baseAlert; | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation TestBedViewController | |
- (void) performDismiss | |
{ | |
[baseAlert dismissWithClickedButtonIndex:0 animated:NO]; | |
} | |
- (void) action: (UIBarButtonItem *) item | |
{ | |
baseAlert = [[[UIAlertView alloc] | |
initWithTitle:@"Please Wait" message:nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!more) { | |
if ([self.items count] < INITIAL_DATA_NUMBER) { | |
self.limit = [NSNumber numberWithInt:INITIAL_DATA_NUMBER]; | |
} else { | |
self.limit = [NSNumber numberWithInt:([self.items count])]; | |
} | |
self.offset= [NSNumber numberWithInt:0]; | |
[self.items removeAllObjects]; | |
} else { | |
self.offset = [NSNumber numberWithInt: |