This file contains hidden or 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
// 设置标题背景图 | |
[functionButton setBackgroundImage:(i == 0 ? firestImageNormal : othersImageNormal) | |
forState:UIControlStateNormal]; | |
[functionButton setBackgroundImage:(i == 0 ? firestImageHighlighted : othersImageHighlighted) | |
forState:UIControlStateHighlighted]; | |
// 未完 |
This file contains hidden or 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
#include<stdio.h> | |
#include<windows.h> | |
#include<malloc.h> | |
int main(void) | |
{ | |
int c; | |
int i; | |
int j; | |
nihao: |
This file contains hidden or 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
#include<stdio.h> | |
int main(void) | |
{ | |
float a,r1,r2,m; | |
char b,c; | |
printf("请输入加油量,汽油类型(a,b,c)以及服务类型(f,m,e)\n"); | |
printf("***************************************************\n"); | |
printf("请输入:"); |
This file contains hidden or 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
#include <stdio.h> | |
int main (int argc, const char * argv[]) { | |
int a, b, i, t; | |
scanf("%d%d", &a, &b); | |
if (a < b) { | |
t = a; |
This file contains hidden or 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
- (IBAction)startOneOffTimer:sender { | |
[NSTimer scheduledTimerWithTimeInterval:2.0 | |
target:self | |
selector:@selector(targetMethod:) | |
userInfo:[self userInfo] |
This file contains hidden or 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
// declcare | |
@property (assign) NSTimer *repeatingTimer; | |
// implements | |
- (IBAction)startRepeatingTimer:sender { | |
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:0.5 |
This file contains hidden or 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
// declare | |
@property (retain) NSTimer *unregisteredTimer; | |
// implements | |
- (IBAction)createUnregisteredTimer:sender { | |
NSMethodSignature *methodSignature = [self methodSignatureForSelector:@selector(invocationMethod:)]; |
This file contains hidden or 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
CLLocationManager *manager = [[CLLocationManager alloc] init]; | |
if (manager.locationServicesEnabled == NO) { | |
UIAlertView *servicesDisabledAlert = [[UIAlertView alloc] initWithTitle:@"Location Services Disabled" message:@"You currently have all location services for this device disabled. If you proceed, you will be asked to confirm whether location services should be reenabled." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; | |
[servicesDisabledAlert show]; | |
[servicesDisabledAlert release]; | |
} |
This file contains hidden or 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
- (IBAction)openGPS:(id)sender { | |
if (locationManager == nil) { | |
locationManager = [[CLLocationManager alloc] init]; | |
locationManager.delegate = self; | |
locationManager.desiredAccuracy = kCLLocationAccuracyBest; // 越精确,越耗电! | |
} | |
[locationManager startUpdatingLocation]; // 开始定位 | |
} |
This file contains hidden or 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 - CLLocationManagerDelegate | |
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { | |
switch (error.code) { | |
case kCLErrorLocationUnknown: | |
NSLog(@"The location manager was unable to obtain a location value right now."); | |
break; | |
case kCLErrorDenied: | |
NSLog(@"Access to the location service was denied by the user."); | |
break; | |
case kCLErrorNetwork: |
OlderNewer