小编Bac*_*lad的帖子

如何在我的应用程序中实现网络错误警报?

我正在开发一个需要网络连接的基于视图的应用程序.我想添加代码,以便在网络不可用时我的应用程序出错.

我无能为力,是否或将什么代码放入appdelegate(.h/.m)和/或viewcontroller(.h/.m)

谁能帮我?

提前致谢 :)

iphone xcode objective-c ios4 ios

5
推荐指数
1
解决办法
2341
查看次数

尝试在方向更改时加载新视图

我正在尝试在Xcode中创建一个应用程序,当手机从一个方向旋转到另一个方向时,该应用程序将切换到新视图.

这是"switchviewcontroller.h"文件代码:

#import <UIKit/UIKit.h>

@interface SwitchViewController : UIViewController {

}

-(IBAction)switchview:(id)sender;

@end
Run Code Online (Sandbox Code Playgroud)

这是"switchviewcontroller.m"文件代码:

#import "SwitchViewController.h"
#import "secondview.h"

@implementation SwitchViewController

-(IBAction)switchview:(id)sender {}

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return YES;
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
    if((fromInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) ||
       (fromInterfaceOrientation == UIInterfaceOrientationLandscapeRight))
    {    
        [[secondview alloc] initWithNibName:@"secondview" bundle:[NSBundle mainBundle]];
    }

}
Run Code Online (Sandbox Code Playgroud)

它在iPhone模拟器中运行没有错误,但是,当我旋转它时不会加载新视图.对于初学者我认为我需要应用程序以横向模式打开,我不知道该怎么做,但它仍然无法工作,我认为它与代码的"initWithNibName"部分有关系因为我有.xib文件而不是.nib文件.任何人都可以帮我这两件事吗?谢谢.

objective-c ios

3
推荐指数
1
解决办法
8118
查看次数

无法摆脱Xcode中的启动画面

我从资源文件夹中删除了Default.png图像,但图片仍然存在,作为启动应用程序时的启动画面.

xcode splash-screen ios4 ios

2
推荐指数
1
解决办法
4087
查看次数

标签 统计

ios ×3

ios4 ×2

objective-c ×2

xcode ×2

iphone ×1

splash-screen ×1