小编Dmi*_*try的帖子

如何获得键盘大小来调整UITextView的大小以及如何在日语键盘上使用UIKeyboardFrameEndUserInfoKey?

如何调整键盘大小UITextView以及如何使用UIKeyboardFrameEndUserInfoKey日语键盘?以下用于调整大小的代码UITextView在标准键盘上运行良好.但不适合日本人.怎么解决?

- (void)keyboardWillShow:(NSNotification *)aNotification {
    [self moveTextViewForKeyboard:aNotification up:YES];
}

- (void)keyboardWillHide:(NSNotification *)aNotification {
    [self moveTextViewForKeyboard:aNotification up:NO]; 
}

- (void) moveTextViewForKeyboard:(NSNotification*)aNotification up: (BOOL) up
{
    NSDictionary* userInfo = [aNotification userInfo];

    // Get animation info from userInfo
    NSTimeInterval animationDuration;
    UIViewAnimationCurve animationCurve;

    CGRect keyboardEndFrame;

    [[userInfo objectForKey:UIKeyboardAnimationCurveUserInfoKey] getValue:&animationCurve];
    [[userInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] getValue:&animationDuration];
    [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] getValue:&keyboardEndFrame];

    // Animate up or down
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:animationDuration];
    [UIView setAnimationCurve:animationCurve];

    CGRect newFrame = textView.frame;
    CGRect keyboardFrame = [self.view convertRect:keyboardEndFrame toView:nil];

    newFrame.size.height -= …
Run Code Online (Sandbox Code Playgroud)

iphone keyboard uitextview ios

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

如何在Objective-C中将变量添加到类别?

需要创建一个带有新变量的类别(类型为NSArray).

OriginalClass + Extension.h:

@interface OriginalClass (Extension) {
    NSArray *_array;
}

@property (nonatomic, retain) NSArray *array;

@end
Run Code Online (Sandbox Code Playgroud)

但我得到了错误:Cannot declare variable inside @interface or @protocol.

请帮忙解决问题.

objective-c categories ios

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

在 Python 中绘制 3d 数组的最有效方法是什么?

在 Python 中绘制 3d 数组的最有效方法是什么?

例如:

volume = np.random.rand(512, 512, 512)
Run Code Online (Sandbox Code Playgroud)

其中数组项表示每个像素的灰度颜色。


以下代码运行速度太慢:

import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.gca(projection='3d')
volume = np.random.rand(20, 20, 20)
for x in range(len(volume[:, 0, 0])):
    for y in range(len(volume[0, :, 0])):
        for z in range(len(volume[0, 0, :])):
            ax.scatter(x, y, z, c = tuple([volume[x, y, z], volume[x, y, z], volume[x, y, z], 1]))
plt.show()
Run Code Online (Sandbox Code Playgroud)

python plot data-visualization scatter matplotlib

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

如何修复Delphi XE2错误:无法安装包,因为它是使用不同版本的Delphi或CBuilder创建的?

我刚刚构建了EmbeddedWebBrowser_XE2.dpk,之后尝试安装它 - 所有这些都是通过IDE内部项目的上下文菜单完成的.并得到错误:

Package can't be installed because it was created with a different version of Delphi or CBuilder?

谢谢您的帮助!

delphi delphi-xe2

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

如何在textarea上检测箭头键的按键事件?

创建以下html页面:

<textarea id="code" rows="10"></textarea>
<script>
  document.onkeydown = function(event) {
    alert(event.keyCode);
  }
</script>
Run Code Online (Sandbox Code Playgroud)

Mobile Safari上打开它(在模拟器上或带键盘的设备上),点击textarea开始编辑.现在按任意箭头键 - 事件不会触发.

如何检测箭头键的按键?

关于Apple Bug报告系统的PS相关问题:13243285

javascript safari events

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

是否可以重置所有继承的 CSS 属性?

如何重置 CSS 文件中类的所有继承属性?我需要能够在元素上设置新属性,而预定义属性不会对其产生影响。

仅使用 CSS 可以吗?

我不是在谈论 CSS 重置,例如:

body {
    margin:0px;
    padding:0px;
}
Run Code Online (Sandbox Code Playgroud)

html css

5
推荐指数
2
解决办法
1027
查看次数

5
推荐指数
2
解决办法
2159
查看次数

xCode 上的“复制期间剥离调试符号”和“剥离链接产品”差异

    \n
  1. 复制\xe2\x80\x9d 期间\xe2\x80\x9cStrip 调试符号和\xe2\x80\x9cStrip 链接产品\xe2\x80\x9d 选项之间有什么区别?

  2. \n
  3. 如果 \xe2\x80\x9cStrip 复制期间调试符号\xe2\x80\x9d = YES 和 \xe2\x80\x9cStrip 链接产品\xe2\x80\x9d = NO 是什么意思?

  4. \n
  5. 是否可以使用单独的 .dsym 文件(而不是二进制文件)上的符号数据将应用程序上传到 App Store?

  6. \n
\n

xcode crash-reports app-store symbolicate ios

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

在 iOS 应用程序上添加自定义文件类型支持是否必须使用 CFBundleTypeIconFile 数组?

CFBundleTypeIconFile在 iOS 应用程序上添加自定义文件类型支持是否必须使用数组?我在 iOS SDK 帮助中找到了不同的信息。

\n\n

我们在这里看到该CFBundleTypeIconFile数组是强制性的:

\n\n
The entry for each document type should contain the following keys:\n\nCFBundleTypeIconFile\nCFBundleTypeName\nCFBundleTypeRole\n\nIn addition to these keys, it must contain at least one of the following keys:\n\nLSItemContentTypes\nCFBundleTypeExtensions\nCFBundleTypeMIMETypes\nCFBundleTypeOSTypes\n
Run Code Online (Sandbox Code Playgroud)\n\n

https://developer.apple.com/library/ios/documentation/general/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-SW9

\n\n

在这里我们可以看到该CFBundleTypeIconFile数组不是强制性的:

\n\n
Each dictionary in the CFBundleDocumentTypes array can include the following keys:\n\nCFBundleTypeName specifies the name of the document type.\nCFBundleTypeIconFiles is an array of filenames for the image resources to use as the document\xe2\x80\x99s icon.\nLSItemContentTypes contains an array …
Run Code Online (Sandbox Code Playgroud)

icons info.plist file-association ios

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

如何通过javascript设置没有id的textarea的值?

通常我们运行javascript代码来设置任何值:

document.getElementById('id_name').value = "...";
Run Code Online (Sandbox Code Playgroud)

但我有一个这样的页面:

<div id="id_name">
    <div class="class_name">
        <textarea></textarea>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

如何通过javascript设置textarea的值?

非常感谢您的帮助!

javascript textarea

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