这可能是一个很容易回答的问题,但经过几个小时的搜索文档和Google后,我自己找不到解决方案.我将Android应用的方向设置landscape在AndroidManifest.xml文件中:
android:screenOrientation="landscape"
Run Code Online (Sandbox Code Playgroud)
但是,当我在模拟器中运行应用程序时,它会出现在横向和纵向模式下.如何将模拟器切换到landscape模式mac?它正在运行1.6 SDK.
无论如何使用Interface Builder更改UILabel文本上的字符间距(轨道)?如果没有,有没有办法在已经使用属性文本创建的现有UILabel上以编程方式执行此操作?
我有以下Android代码,一旦按下按钮就可以播放声音:
Button SoundButton2 = (Button)findViewById(R.id.sound2);
SoundButton2.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
mSoundManager.playSound(2);
}
});
Run Code Online (Sandbox Code Playgroud)
我的问题是我希望在按下按钮(触摸下来)时立即播放声音,而不是在释放声音时(触摸起来).有关如何实现这一目标的任何想法?
如何使用多个属性订购我的Realm结果?
我首先使用这样的属性对它们进行排序:
allShows = Show.allObjects().sortedResultsUsingProperty("dateStart", ascending: true)
Run Code Online (Sandbox Code Playgroud)
但现在我也想通过另一个属性"timeStart"进行二次排序.我试过这样的:
allShows = Show.allObjects().sortedResultsUsingProperty("dateStart", ascending: true).sortedResultsUsingProperty("timeStart", ascending: true)
Run Code Online (Sandbox Code Playgroud)
这只会使结果仅由第二个属性排序.请帮忙.
由于以下原因,Google一直拒绝我的应用:"在审核期间,我们发现如果在插入Android Auto体验时设备上播放音频,则音乐将继续通过汽车扬声器播放而无需用户意图.我们将此视为司机分心,并不适合Android Auto应用程序."
我认为我已经采取了相应的步骤来解决这个问题,请按照此处的文档进行操作:https://developer.android.com/training/auto/audio/index.html#isconnected
然而,出于同样的原因,他们再次拒绝了我.
在我的MediaBrowserServiceCompat StreamService类中,我添加了以下代码:
private IntentFilter androidAutoConnectionIntentFilter = new IntentFilter("com.google.android.gms.car.media.STATUS");
private AndroidAutoConnectionStatusReceiver androidAutoConnectionStatusReceiver = new AndroidAutoConnectionStatusReceiver();
Run Code Online (Sandbox Code Playgroud)
在onCreate()中,我添加了:
registerReceiver(androidAutoConnectionStatusReceiver, androidAutoConnectionIntentFilter);
Run Code Online (Sandbox Code Playgroud)
并将此类添加到服务中:
private class AndroidAutoConnectionStatusReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
System.out.println("*** ANDROID AUTO CONNECTED: " + intent);
String status = intent.getStringExtra("media_connection_status");
boolean isConnectedToCar = "media_connected".equals(status);
if (isConnectedToCar) {
// android auto connected so stop playback
Intent stopIntent = new Intent(context, StreamService.class);
stopIntent.setAction(StreamService.ACTION_PLAYER_STOP);
context.startService(stopIntent);
}
}
}
Run Code Online (Sandbox Code Playgroud)
知道我如何更新我的应用程序以解决这种拒绝?
我的XCode项目以多种配置的方式设置,允许我为我的应用程序的不同变体使用相同的代码库,但每个都有独特的元素,如应用程序名称,版本,包标识符,图标,启动屏幕等我已经关注了这个网站,以便进行大部分设置:http: //appfoundry.be/blog/2014/07/04/Xcode-Env-Configuration/
我还有一个config.plist,其中包含与每个XCode配置相关联的各种唯一设置,这些设置只能在构建时成功复制.以下是运行脚本构建阶段的片段,以便执行此操作:
RESOURCE_PATH=${SRCROOT}/${PRODUCT_NAME}/config/${CONFIGURATION}
BUILD_APP_DIR=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app
echo "Copying all files under ${RESOURCE_PATH} to ${BUILD_APP_DIR}"
cp -v "${RESOURCE_PATH}/"* "${BUILD_APP_DIR}/"
Run Code Online (Sandbox Code Playgroud)
我的下一个目标是能够在构建时复制特定配置的资产目录,以避免将所有不同配置的图像捆绑到构建中,从而导致它变得臃肿.我使用Run Script尝试了与上面相同的解决方案,更改了复制行以包含递归选项(因为资产目录本质上是一个目录):
cp -rv "${RESOURCE_PATH}/"* "${BUILD_APP_DIR}/"
Run Code Online (Sandbox Code Playgroud)
但是,当我这样做时,我的应用程序无法构建,并说它无法找到应用程序图标并启动图像.有任何想法吗?
我有以下方法:
- (NSMutableArray *)getFilteredArrayFromArray:(NSMutableArray *)array withText:(NSString *)text {
if ([array count] <= 0)
return nil;
NSMutableArray *arrayToFilter = [NSMutableArray arrayWithArray:array];
NSString *nameformatString = [NSString stringWithFormat:@"stationName contains[c] '%@'", text];
NSPredicate *namePredicate = [NSPredicate predicateWithFormat:nameformatString];
NSString *descformatString = [NSString stringWithFormat:@"stationTagline contains[c] '%@'", text];
NSPredicate *descPredicate = [NSPredicate predicateWithFormat:descformatString];
NSString *aToZformatString = [NSString stringWithFormat:@"stationSearchData.browseAtozArray.city contains[c] '%@'", text];
NSPredicate *aToZPredicate = [NSPredicate predicateWithFormat:aToZformatString];
NSPredicate * combinePredicate = [NSCompoundPredicate orPredicateWithSubpredicates:[NSArray arrayWithObjects:namePredicate, descPredicate, aToZPredicate, nil]];
[arrayToFilter filterUsingPredicate:combinePredicate];
return arrayToFilter;
}
Run Code Online (Sandbox Code Playgroud)
前2个谓词工作正常.但最后一个(aToZPredicate),是行不通的.stationSearchData是一个StationSearchData对象,而browseAtozArray是一个NSMutableArray.
如何使用谓词基本上搜索数组中数组中的数组?
这是StationSearchData对象的接口:
@interface StationSearchData : …Run Code Online (Sandbox Code Playgroud) 我有以下代码创建一个ImageButton并在单击时播放声音:
ImageButton SoundButton1 = (ImageButton)findViewById(R.id.sound1);
SoundButton1.setImageResource(R.drawable.my_button);
SoundButton1.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN ) {
mSoundManager.playSound(1);
return true;
}
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
问题是我希望按下它时ImageButton上的图像会发生变化.OnTouchListener似乎覆盖了触摸并且不允许图像更改.一旦我删除了OnTouchListener,ImageButton会在按下时切换到不同的图像.关于如何在仍然使用OnTouchListener时在ImageButton上更改图像的任何想法?非常感谢你!
我的Show对象如下所示:
class Show: RLMObject {
dynamic var venue: Venue?
}
Run Code Online (Sandbox Code Playgroud)
和我的Venue对象:
class Venue: RLMObject {
dynamic var title = ""
}
Run Code Online (Sandbox Code Playgroud)
我需要能够通过Venue对象的标题对Show对象进行排序.我尝试了以下但出现了错误:
allShowsByLocation = Show.allObjects().sortedResultsUsingProperty("venue.title", ascending: true)
Run Code Online (Sandbox Code Playgroud)
错误是:无效的排序列',原因:'找不到列'(null)'.
ios ×6
android ×4
swift ×4
realm ×2
android-auto ×1
button ×1
imagebutton ×1
objective-c ×1
uilabel ×1
xcode ×1
xcodebuild ×1