我写了一个Android应用程序.现在,我想让设备在某个动作发生时振动.我怎样才能做到这一点?
我创建了一个具有float属性的NSView子类,我想在Interface Builder中设置它.在"用户定义的运行时属性"部分中,唯一合适的类型是"数字".但是如果我想输入一个十进制数(使用.或者作为分隔符),它只会舍入到最接近的整数.这是一个错误还是故意的?如何定义浮点数而不是整数?
由于最近更新Xcode 4.3现在似乎默认为LLDB调试器.我刚刚发现我的NSLog语句没有显示在控制台中.在搜索了答案后,找不到,我切换回GDB并且工作正常.我发现其他人在LLDB中提到了NSLog,所以我不明白为什么它在我的情况下失败了.它应该不一样吗?LLDB有不同的方法吗?
我正在使用Google地图.我能够成功创建并显示Google地图.现在我想补充一下CameraUpdate(latitude, longitude).我用谷歌搜索,我找到了一些源代码,但我得到了一个NullPointerException.
LogCat错误消息是:
java.lang.NullPointerException: CameraUpdateFactory is not initialized
Run Code Online (Sandbox Code Playgroud)
这是我的来源.我究竟做错了什么?
public class StradaContact extends Fragment {
public final static String TAG = StradaContact.class.getSimpleName();
private MapView mMapView;
private GoogleMap mMap;
private Bundle mBundle;
double longitude = 44.79299800000001, latitude = 41.709981;
public StradaContact() {
}
public static StradaContact newInstance() {
return new StradaContact();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.strada_contact, container,false);
mMapView = (MapView) rootView.findViewById(R.id.pointMap);
mMapView.onCreate(mBundle);
setUpMapIfNeeded(rootView);
return rootView;
}
@Override …Run Code Online (Sandbox Code Playgroud) 我正在使用cordova 3.5.0-0.2.6(最后一个稳定版本).我在锁定iPad设备的方向时遇到问题.在iPhone上它正常工作,但在iPad上方向没有锁定.
我想锁定整个应用程序,而不仅仅是页面.
这是我当前的config.xml:
<?xml version="1.0" encoding="utf-8"?>
<widget id="com.domain"
version="version"
xmlns="http://www.w3.org/ns/widgets">
<name>xxx</name>
<description>Lorem ipsum</description>
<access origin="*"/>
<author email="x@x" href="https://x.com">x</author>
<content src="index.html?platform=cordova"/>
<feature ...></feature>
<preference name="permissions" value="none"/>
<preference name="orientation" value="portrait"/>
<preference name="show-splash-screen-spinner" value="true"/>
<preference name="auto-hide-splash-screen" value="true"/>
<preference name="prerendered-icon" value="true"/>
<preference name="disallowoverscroll" value="true"/>
<preference name="webviewbounce" value="false"/>
<preference name="StatusBarOverlaysWebView" value="false"/>
<preference name="StatusBarBackgroundColor" value="#000000"/>
</widget>
Run Code Online (Sandbox Code Playgroud)
生成的plist文件如下所示:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations¨ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
Run Code Online (Sandbox Code Playgroud) 我总是不使用钳子,因为我不确定如何使用它.
谁能给出一个使用plist 的简单代码示例?我有兴趣保存一个NSArray或NSDictionary一个plist,然后再次检索它.
是否有任何好处/坏处存储或者一个NSArray或一个NSDictionary?此外,是否有任何关于你可以或不能存储在plist中的规则?
我正在开发一个Cocoa Mac OSX应用程序,我想知道是否有可能通过以下方式呈现NSRange找到的内容:
NSRange range;
range.location = 4;
range.length = 4;
Run Code Online (Sandbox Code Playgroud)
作为一个NSString?
例如,在上面的示例中,如果我有一个内容为"abcdefgh"的字符串,则将上述范围的内容显示为字符串将给出"efgh".这可能吗?
我已经在互联网上到处搜索了解决方案,但似乎找不到确切的答案。
基本上,我希望在android平台上实现3D音频环境。我正在寻找的是一个能够使用类似坐标系的东西将声音放置在虚拟空间中的android库。
我知道iOS具有OpenAL,但是否有Android等效产品?我也知道AudioTrack该类的存在,但是我正在寻找一些不太原始的东西。
提前致谢。
请考虑以下代码:
JSONObject json = new JSONObject();
json.put("one", 1);
json.put("two", 2);
json.put("three", 3);
Run Code Online (Sandbox Code Playgroud)
如果我打印jsonobject它打印像这样
{"three":"1","two":"2","one":"1"}
Run Code Online (Sandbox Code Playgroud)
但我想要这样.
{"one":"1","two":"2","three":"3"}
Run Code Online (Sandbox Code Playgroud)
请帮忙.提前致谢.
我已经以UITabBar编程方式定义了一个但是如何UITabBar在项目处于活动状态时设置自定义图标?
这是我用于声明UITabBar按钮的代码,但是如何在活动时设置自定义图像?
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = NSLocalizedString(@"Free", @"Free");
self.tabBarItem.image = [UIImage imageNamed:@"Free.png"];
}
return self;
}
Run Code Online (Sandbox Code Playgroud) 我创建了一个js库(MessageBus.js)并使其与requirejs兼容.现在我想使用不带requirejs的同一个lib,即创建对象(新的MessageBus()).
我正在用这篇文章附上我的lib.
define([], function () {
var MessageBus = function () {
this.channelCallBackMap = {};
this.alreadyRegistred = false;
}
MessageBus.prototype = {
publish: function (channel, message) {
//Put original message and channel in the envelope and send it
var envelope = {
channel: channel,
message: message
};
var domain = location.protocol + '//' + location.host;
//Send message to all sibling iframes in the parent document
$("iframe", parent.document.body).each(function (i, frame) {
frame.contentWindow.postMessage(JSON.stringify(envelope), domain);
});
},
subscribe: function (channels, callbacks) {
var …Run Code Online (Sandbox Code Playgroud) 我刚刚从另一个人那里继承了一个Xcode项目,由于某些原因我似乎无法在模拟器中运行它.
有没有其他人有这个问题?有没有人有任何想法如何解决这个问题?

ios ×4
android ×3
objective-c ×3
xcode ×3
java ×2
audio ×1
audiotrack ×1
cocoa ×1
cocoa-touch ×1
console ×1
cordova ×1
debugging ×1
ios5 ×1
ipad ×1
javascript ×1
jquery ×1
json ×1
kvc ×1
macos ×1
nsarray ×1
nsrange ×1
nsstring ×1
openal ×1
orientation ×1
plist ×1
requirejs ×1
vibration ×1
xcode4 ×1