小编And*_*rey的帖子

iphone 5视网膜显示器的图像

iPhone 5发布,具有新的屏幕尺寸和分辨率.

当我们使用iPhone 4(视网膜)的图像时,我们只是将"@ 2x"添加到图像名称.任何人都可以告诉我,是否有可能为新的iPhone屏幕添加不同的图像(背景,按钮等)?

第二个问题:我可以在我的应用程序中使用单独的XIB文件:对于旧的iPhone,iPhone新的(如iPhone和iPad)?

谢谢!

iphone retina-display iphone-5

19
推荐指数
2
解决办法
2万
查看次数

类型'string'不符合协议NilLiteralConvertible

在我的Swift代码中:

override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
    let stringIdent = String(format: "section_1_%d", section)
    return NSLocalizedString(stringIdent, comment: nil)
}
Run Code Online (Sandbox Code Playgroud)

运行构建时出现错误:

类型'string'不符合协议NilLiteralConvertible

此代码始终在Objective-C中有效.

Swift可能有什么问题?

ios swift

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

动态更改UILabel宽度不适用于autolayout

我有一些代码:

CGRect currentFrame = textLabel.frame;
CGSize max = CGSizeMake(textLabel.frame.size.width, 3000);
CGSize expected = [[textLabel text] sizeWithFont:textLabel.font constrainedToSize:max lineBreakMode:textLabel.lineBreakMode];
currentFrame.size.height = expected.height;
textLabel.frame = currentFrame;

expected.height = expected.height + 70;

[scrollView setContentSize:expected];
Run Code Online (Sandbox Code Playgroud)

textLabel放在UIScrollView中以显示多行文本信息.

在旧版本的应用程序中,没有4英寸屏幕支持,一切都很完美.但现在,不幸的是,调整UILabel的大小不起作用.

也许,有人可以建议我,我应该改变什么?

谢谢.

ios autolayout

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

如何在UIToolbar中沿长度分配按钮?

在我的应用程序中,我使用了一些代码,动态地将带有图像的按钮添加到UIToolbar:

[self.navigationController setToolbarHidden:NO];
UIImage *buttonImage1 = [UIImage imageNamed:@"1.png"];
UIImage *buttonImage2 = [UIImage imageNamed:@"2.png"];
UIImage *buttonImage3 = [UIImage imageNamed:@"3.png"];

UIBarButtonItem *toolButton1 = [[UIBarButtonItem alloc] initWithImage:buttonImage1 style:UIBarButtonItemStylePlain target:self action:@selector(btnSettingsClick:)];
UIBarButtonItem *toolButton2= [[UIBarButtonItem alloc] initWithImage:buttonImage2 style:UIBarButtonItemStylePlain target:self action:@selector(btnSettingsClick:)];
UIBarButtonItem *toolButton3 = [[UIBarButtonItem alloc] initWithImage:buttonImage3 style:UIBarButtonItemStylePlain target:self action:@selector(btnSettingsClick:)];

[self setToolbarItems:[NSArray arrayWithObjects:toolButton1, toolButton2, toolButton3, nil]];
Run Code Online (Sandbox Code Playgroud)

但它运作不佳:

截图

如果我尝试设置另一个按钮样式:

toolButton1.style = UIBarButtonSystemItemFlexibleSpace;
toolButton2.style = UIBarButtonSystemItemFlexibleSpace;
toolButton3.style = UIBarButtonSystemItemFlexibleSpace;
Run Code Online (Sandbox Code Playgroud)

它看起来也很差:

截图2

我怎样才能解决这个问题?

objective-c uitoolbar uibarbuttonitem ios

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

Delphi在加载时禁用表单

在我的应用程序中,我有一个主窗体,能够在数据库中加载一些图像.在加载图像时,我想显示一个带有进度指示器的表单(带有bsNone边框样式).

但是,如果我使用ShowModal显示表单,主表单的执行会停止,所以我不能这样做.

如果我调用Show,则用户可以访问所有其他表单组件,这可能很危险,而照片未完全加载.

我需要得到方法,禁用主窗体上的所有内容,而加载没有完成.

请告诉我,这是怎么可能的.

delphi tform

6
推荐指数
2
解决办法
5880
查看次数

Delphi从DLL中打开模态窗体

我需要向应用程序添加一些插件功能,以及动态加载和打开插件的能力。

在我的应用程序(主窗体)中,我有以下代码:

procedure TfrmMain.PluginClick(Sender: TObject);
Var
  DllFileName : String;
  DllHandle   : THandle;
  VitoRunPlugin : procedure (AppHandle, FormHandle : HWND);
begin
  DllFileName := (Sender AS TComponent).Name + '.dll';
  DllHandle := LoadLibrary(PWideChar (DllFileName));

  if DllHandle <> 0 then
  Begin
    @VitoRunPlugin := GetProcAddress (DllHandle, 'VitoRunPlugin');
    VitoRunPlugin (Application.Handle, Self.Handle);
  End Else Begin
    ShowMessage ('Plugin load error');
  End;

  FreeLibrary (DllHandle);
end;
Run Code Online (Sandbox Code Playgroud)

我的插件库是(现在仅用于测试):

library plugintest;

uses
  System.SysUtils, WinApi.Windows,
  Vcl.Forms,
  System.Classes,
  Vcl.StdCtrls;

{$R *.res}

Procedure VitoRunPlugin (AppHandle, FormHandle : HWND);
  Var F : TForm;  B: TButton;
Begin …
Run Code Online (Sandbox Code Playgroud)

delphi dll delphi-xe2

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

jOOQ addConditions:在SQL问号中出现而不是值

我想启动简单的代码:

SelectQuery query = dsl.select(field ("id"), field("title")).from("dict.models").getQuery();
if (modelId > 0) query.addConditions(field("model_id", SQLDataType.INTEGER).equal(modelId));
Run Code Online (Sandbox Code Playgroud)

但幸运的是,getSQL()我只能看到:

select id, title from dict.models where model_id = ?
Run Code Online (Sandbox Code Playgroud)

哪里出错?

谢谢.

java sql jooq

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

Android手柄'搜索'按钮按下自定义键盘

我正在开发自己的自定义键盘.

如果我们的键盘用IME_ACTION_SEARCH参数打开,如何处理"搜索"按钮?

我有以下代码,但不幸的是在搜索案例中它不起作用.在正常情况下使用完成按钮它工作正常.

        final int options = this.getCurrentInputEditorInfo().imeOptions;
        final int actionId = options & EditorInfo.IME_MASK_ACTION;

        switch (actionId) {
            case EditorInfo.IME_ACTION_SEARCH:
                ic.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SEARCH));
                break;
            default:
                ic.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
        }
Run Code Online (Sandbox Code Playgroud)

谢谢

android custom-keyboard

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

如何在DevExpress QuantumGrid(VCL)中的onCustomDrawCell事件中获取列索引

在我的应用程序中,我需要绘制一些不同颜色的网格列(不完全是行).如何从TcxGridTableDataCellViewInfo变量中获取当前columt id?

谢谢.

delphi vcl devexpress

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

如何在 SwiftUI 中从确认对话框打开 PhotosPicker?

我想制作一个 ActionSheet,用户可以在其中选择是否要从图库中选择图像或拍照。

然而,在实现这一点时,我无法找到在这种情况下如何调用 PhotosPicker 的方法。下面的代码不起作用:显示“从图库中选择”项目,但点击时没有反应。

我将非常感谢任何建议。

谢谢你!

            Button {
                displayImageActionSheet = true
            } label: {
                Image("user_photo_placeholder")
            }
            .confirmationDialog("Profile picture",
                                isPresented: $displayImageActionSheet,
                                titleVisibility: .visible) {
               
                
                PhotosPicker("Choose from gallery",
                                         selection: $selectedPhotoImage,
                                         matching: .any(of: [.videos, .not(.images)]))
                
                Button("Take picture") {
                    
                }
                
                Button("Remove", role: .destructive) {
                    
                }
            }
Run Code Online (Sandbox Code Playgroud)

swiftui

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