如何知道是否NSUserDefaults
包含任何值?如何检查其是否为空?
我有价值NSUserdefaults
.我正在使用storyboard
,它嵌入在UINavigationController
.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if([[NSUserDefaults standardUserDefaults]objectForKey:@"isLoggedIn"]){
//show home page here
}else{
// show login view
}
}
Run Code Online (Sandbox Code Playgroud)
我可以使用打开应用程序URL
还
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
NSString *text = [[url host] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
if(text.length > 0){
// show home page
}else {
// show settings page
}
return YES;
}
Run Code Online (Sandbox Code Playgroud)
如何根据检索到的值设置rootViewController
for UINavigationController
.任何人都可以帮帮我吗?
objective-c storyboard nsuserdefaults uinavigationcontroller appdelegate
我是NSCache的新手.
我有一个API调用,导致几个对象.如何在NSCache中存储这些对象,以便我不需要再次调用API.
NSCache中可以存储多少数据.是否存在将数据存储在NSCache中的特定限制.
请帮我.
长按时自定义注释引脚更改为默认红色引脚.
- (MKAnnotationView *) mapView:(MKMapView *)mapingView viewForAnnotation:(id <MKAnnotation>) annotation {
MKPinAnnotationView *annView = nil;
if(annotation != mapingView.userLocation)
{
static NSString *defaultPinID = kDEFAULTPINID;
annView = (MKPinAnnotationView *)[mapingView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if ( annView == nil )
annView = [[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:defaultPinID] ;
annView.canShowCallout = YES;
annView.image = [UIImage imageNamed:@"icon.png"];//sets image for default pin
}
return annView;
}
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKPinAnnotationView *)view
{
if ([[view.annotation title] isEqualToString:@"AnnotationTitle"] ) {
view.image = [UIImage imageNamed:@"selected_IconImage.png"];
}
}
Run Code Online (Sandbox Code Playgroud)
只需触摸注释引脚即可显示所选图像.但是,长时间点击引脚自定义图像将恢复为默认红色引脚.
如何解决这个问题?
如何在iOS 6中集成地图.早期的iOS版本是否支持它?
我想在应用程序中显示一个地图,该地图必须支持iOS 5及更高版本.我怎么能这样做?在早期版本中,iOS使用谷歌地图,在最新版本中,它使用自己的地图.
有人会帮助我吗?
我在xcode 5中创建了一个通用应用程序.如何设置应用程序图标并从常规选项卡启动图像?
单击应用程序图标附近的箭头按钮,
如何在这里设置AppIcon?有人可以帮帮我吗?
我目前正在尝试连接到tcp服务器.一切都很好,但如果服务器不可用,应用程序冻结约30秒,这不是很好.我已经搜索了一个分辨率,但到目前为止找不到有用的东西.
也许你们中的某个人有一个检查连接的解决方案?
CFReadStreamRef readStream;
CFWriteStreamRef writeStream;
CFStreamCreatePairWithSocketToHost(NULL, (__bridge CFStringRef)@"IP_SERVER_PATH", 6666, &readStream, &writeStream);
inputStream = (__bridge NSInputStream *)readStream;
outputStream = (__bridge NSOutputStream *)writeStream;
[inputStream setDelegate:self];
[outputStream setDelegate:self];
[inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[inputStream open];
[outputStream open];
Run Code Online (Sandbox Code Playgroud) 我有一个字符串2013-01-10T08:24:12.503这是'日期'和'时间'.这是我从服务器收到的格式.
我希望以2013-01-10 08:24:12的格式显示.我怎样才能做到这一点?
请帮帮我.
objective-c ×6
cocoa-touch ×2
ios ×2
appdelegate ×1
icons ×1
ios6 ×1
ios6-maps ×1
ios7 ×1
launch ×1
nscache ×1
nsdate ×1
storyboard ×1
tcp-ip ×1