我想创建UIView一个UITabBarController
这是我的.h文件代码:
@interface TE : UIViewController <UITabBarControllerDelegate>{
UITabBarController *tabBarController;
}
@property (nonatomic,retain) UITabBarController *tabBarController;
@end
Run Code Online (Sandbox Code Playgroud)
该viewDidLoad方法:
UIViewController *testVC = [[T1 alloc] init];
UIViewController *otherVC = [[T2 alloc] init];
NSMutableArray *topLevelControllers = [[NSMutableArray alloc] init];
[topLevelControllers addObject: testVC];
[topLevelControllers addObject: otherVC];
tabBarController = [[UITabBarController alloc] init];
tabBarController.delegate = self;
[tabBarController setViewControllers:topLevelControllers animated:NO];
tabBarController.selectedIndex = 0;
self.view = tabBarController.view;
Run Code Online (Sandbox Code Playgroud)
这会创建标签栏控制器,但是当我单击标签栏项时,我收到一个错误:
Thread1:程序接收信号:SIGABRT
编辑:我通过下载和修改http://www.iphonedevcentral.com/create-uitabbarcontroller/的版本解决了这个问题
由于在添加图像时我有很多这些(内存不足),我想知道Bitmap对象支持的最大大小是什么,以及如何有效地管理它们.
我需要创建一个在所有活动之间都具有共享菜单的应用程序,但是我在为所有活动创建相同菜单并使这些活动成为“单身”之间犹豫不决,或者创建多个片段并在具有该菜单的一个活动中使用它们。
我想让我的应用程序与大多数设备兼容,所以我不知道哪一个是最好的(用于内存管理和可重复使用的东西...)
我应该怎么做?如果有比这两个过程更好的过程,请随时提出:)
android menu android-fragments android-activity android-fragmentactivity
嗨,我想在我的Blackberry应用程序中添加一个SplashScreen,我从这里修改了代码并将其修改为:
package main;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.system.*;
import java.util.*;
public class SplashScreen extends MainScreen {
private UiApplication application;
private Timer timer = new Timer();
private static final Bitmap _bitmap = Bitmap.getBitmapResource("SPlachS.png");
public SplashScreen(UiApplication ui) {
super(Field.USE_ALL_HEIGHT | Field.FIELD_LEFT);
this.application = ui;
this.add(new BitmapField(_bitmap));
SplashScreenListener listener = new SplashScreenListener(this);
this.addKeyListener(listener);
timer.schedule(new CountDown(), 5000);
application.pushScreen(this);
}
public void dismiss() {
timer.cancel();
application.popScreen(this);
application.pushScreen(new MyScreen());
}
.....
Run Code Online (Sandbox Code Playgroud)
我只是修改了构造函数,这就是全部(我也尝试过这里的代码),但我总是有一个未捕获的运行时异常