1 xib 图片错位 laoutsubview 去掉对钩
调整对其方式
2 判断登陆注册的用户名密码 使用正则表达式
//判断石否为数字或字母
- (BOOL)validatePassword:(NSString *)email {
NSString *emailRegex = @"^[A-Za-z0-9]+$";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
return [emailTest evaluateWithObject:email];
}
//判断是否为手机号
- (BOOL)validatePhone:(NSString *)email {
NSString *emailRegex = @"^1(3[0-9]|5[0-35-9]|8[025-9])\\d{8}$";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
return [emailTest evaluateWithObject:email];
}
//判断是否为邮箱
- (BOOL)validateEmail:(NSString *)email {
NSString *emailRegex = @"^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
return [emailTest evaluateWithObject:email];
}
assihttprequest
http://www.cnblogs.com/dotey/archive/2011/05/10/2041966.html
http://www.cfanz.cn/index.php?c=article&a=read&id=70754
3 base64 冲突
删除掉 Other Linker Flag 的 -all_load 就可以解决静态库冲突的问题,
4 有的是库不识别,可能是因为两个版本,一个模拟器,一个真机,调整一下位置,
当前用哪个就把哪一个放到上面,再运行就是别了
5 GPS定位不准确,我们可以用地图定位和代替,简单误差小
#pragma mark - 获取经纬度和城市
-(void)getCurrentLocation
{
_mapView = [[MAMapViewalloc] init];
[_mapView setHidden:YES];
_mapView.showsUserLocation =YES;
_mapView.delegate = self;
}
- (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation {
_currentLocation = userLocation.location;
_lon = _currentLocation.coordinate.longitude;
_lat = _currentLocation.coordinate.latitude;
_tableObject_dis.lon = _lon;
_tableObject_dis.lat = _lat;
_placemark = nil;
if ([[[UIDevicecurrentDevice] systemVersion]floatValue] >= 5.0) {
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:_currentLocation completionHandler:^(NSArray *placemarks, NSError*error){
if (!error)
{
_placemark = [placemarks objectAtIndex:0];
if (_placemark.administrativeArea)
{
NSArray *stateName = [_placemark.administrativeArea componentsSeparatedByString:@"市"];
_currentState =[stateName objectAtIndex:0] ;
mapView.showsUserLocation = NO;
}
}
}];
[geocoder release];
}
}
6 自定义一个并且组装一个自己的alertView
iOS7 不允许自定义uialertview
7 设备 4 or 5 区分长度 is4Inch
//判断是否 Retina屏、设备是否iphone 5、是否是iPad
#define isRetina ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
#define is4Inch ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define isPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
7 系统版本 6 or 7 区分 20 像素
if (!([[UIDevicecurrentDevice] systemVersion].floatValue>=7.0))