小编Cup*_*Kay的帖子

DropWizard服务资产需要帮助

救命!我已经尝试了几个小时,谷歌搜索任何我能想到的东西.我有一个问题,我想在我的网站上显示我的静态内容而不是我的应用程序.我修改了一个简单的hello-world应用程序:

public static void main(String[] args) throws Exception {
    Class.forName("org.sqlite.JDBC");
    new HelloWorldApplication().run(args);
}

@Override
public String getName() {
    return "hello-world";
}

@Override
public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap) {
    bootstrap.addBundle(new AssetsBundle("/assets/*", "/"));
}

@Override
public void run(HelloWorldConfiguration configuration, Environment environment) {
    final HelloWorldResource resource = new HelloWorldResource(
            configuration.getTemplate(),
            configuration.getDefaultName()
        );
    final AddResource addResource = new AddResource();
    final DeleteResource deleteResource = new DeleteResource();
    final TemplateHealthCheck healthCheck = new TemplateHealthCheck(configuration.getTemplate());
    environment.healthChecks().register("template", healthCheck);
    environment.jersey().register(resource);
    environment.jersey().register(addResource);
    environment.jersey().register(deleteResource);
}
Run Code Online (Sandbox Code Playgroud)

这是我的hello-world.yml:

server:
  type: simple
  applicationContextPath: /application/hello-world

template: Hello, …
Run Code Online (Sandbox Code Playgroud)

java yaml pom.xml dropwizard

4
推荐指数
2
解决办法
6785
查看次数

iOS视图在addSubview上重置

我有一个带有方形图像的故事板中间位于:280,140(垂直)当应用程序启动时,我可以通过按下按钮移动此imageView.我使用以下方法移动imageView:

    _mainImage.frame = CGRectMake(_mainImage.frame.origin.x + 2, _mainImage.frame.origin.y, _mainImage.frame.size.width, _mainImage.frame.size.height);
Run Code Online (Sandbox Code Playgroud)

在应用程序运行时,我不断向mainView添加新的imageView:

UIImageView *imgView;
imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, yCoordinate, 50, 10)];
imgView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:imgView];
Run Code Online (Sandbox Code Playgroud)

每当我调用此代码时,我放置在中间并移动的方形图像视图将被设置回其起始位置.看起来每次调用addSubview时mainView都会"重置".有没有办法在没有mainView"重置"的情况下添加子视图?

objective-c reset addsubview ios

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

没有可见的@interface for x声明了选择器initwithnib:bundle

#import "levelSelectorController.h"
#import "ViewController.h"
ViewController *viewController;

@interface levelSelectorController ()

@end

@implementation levelSelectorController

- (void)viewDidLoad
{
     [super viewDidLoad];
     // Do any additional setup after loading the view, typically from a nib.
    if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
        // iOS 7
        [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
    } else {
        // iOS 6
        [[UIApplication sharedApplication] setStatusBarHidden:YES     withAnimation:UIStatusBarAnimationSlide];
    }
    viewController = [[ViewController alloc] initWithNib:@"ViewController" bundle:nil];
}

@end
Run Code Online (Sandbox Code Playgroud)

这里发生错误:

viewController = [[ViewController alloc] initWithNib:@"ViewController" bundle:nil];
Run Code Online (Sandbox Code Playgroud)

我已经尝试了一些我在stackoverflow上读到的不同的东西,我理解错误应该是什么意思.但我仍然无法解决问题.

bundle objective-c uiviewcontroller viewcontroller

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