我制作复杂的布局,并使用"include"作为我的自定义组件,就像这样
<include layout="@layout/topbar"/>
Run Code Online (Sandbox Code Playgroud)
并且topbar定义如下:
<?xml version="1.0" encoding="utf-8"?>
<my.package.TopBarLayout
... a lot of code
Run Code Online (Sandbox Code Playgroud)
现在,我想将我的自定义属性传递给"topbar",就像这样
<include layout="@layout/topbar" txt:trName="@string/contacts"/>
Run Code Online (Sandbox Code Playgroud)
但我没有结果.我从那个页面了解到我不能设置任何属性,而是id,height和width.
那么,我如何将我的自定义属性传递给包含,以及如何使其工作?
老方法
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:count];
Run Code Online (Sandbox Code Playgroud)
现在给出了错误Attempting to badge the application icon but haven't received permission from the user to badge the application.
然后我尝试使用新的API(我认为这与徽章价值有关)
CKModifyBadgeOperation * operation = [[CKModifyBadgeOperation alloc] initWithBadgeValue:50];
[operation setModifyBadgeCompletionBlock:^(NSError *error) {
NSLog(@"%@", error);
}];
[operation start];
Run Code Online (Sandbox Code Playgroud)
但是我收到了错误 <CKError 0x165048a0: "Not Authenticated" (9/1002); "This request requires an authenticated account">
如何设置徽章或获得一些新权限?
我发现Testflight支持通过API调用上传应用程序http://testflightapp.com/api/builds.format.它接受应用程序包,dsyms,应用程序信息等.
接下来我的问题是:是否有任何自动脚本用于xcode,它会在"归档"操作后将构建内容上传到Testflight中?请分享链接.
解决方案就在这里(Mac OS X 10.8):
1)按照本手册设置执行后脚本
2)删除用下一个规则替换"echo"字符串:
#!/bin/bash
#
# (Above line comes out when placing in Xcode scheme)
#
API_TOKEN="<YOUR-TESTFLIGHT-API-TOKEN>"
TEAM_TOKEN="<YOUR-TESTFLIGHT-TEAM-TOKEN>"
SIGNING_IDENTITY="iPhone Developer"
PROVISIONING_PROFILE="${HOME}/Library/MobileDevice/Provisioning Profiles/<YOUR-PROFILE-NAME>.mobileprovision"
LOG="/tmp/testflight.log"
GROWL="/usr/bin/terminal-notifier -title Xcode -message"
DATE=$( /bin/date +"%Y-%m-%d" )
ARCHIVE=$( /bin/ls -t "${HOME}/Library/Developer/Xcode/Archives/${DATE}" | /usr/bin/grep xcarchive | /usr/bin/sed -n 1p )
DSYM="${HOME}/Library/Developer/Xcode/Archives/${DATE}/${ARCHIVE}/dSYMs/${PRODUCT_NAME}.app.dSYM"
APP="${HOME}/Library/Developer/Xcode/Archives/${DATE}/${ARCHIVE}/Products/Applications/${PRODUCT_NAME}.app"
#/usr/bin/open -a /Applications/Utilities/Console.app $LOG
#echo -n "Creating .ipa for ${PRODUCT_NAME}... " > $LOG
${GROWL} "Creating .ipa for ${PRODUCT_NAME}"
/bin/rm "/tmp/${PRODUCT_NAME}.ipa"
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${APP}" …Run Code Online (Sandbox Code Playgroud) 我有一些标准的android ellipsize机制的问题.
我的textview xml布局是下一个:
<TextView
android:id="@+id/something"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/message_test_text"
android:lines="2"
android:ellipsize="end"
android:textColor="@drawable/dialogs_text_selector"
/>
Run Code Online (Sandbox Code Playgroud)
然后在代码中我将Helvetica字体设置为此字段.然后,在第二行的末尾,我看到点后的符号破碎:

因为它在列表中使用,我看到一个正方形列表.
我可以删除它没有大量的代码吗?
谢谢!
在iOS 9中,MPMoviePlayer和他的所有组件都已弃用.我们使用MPMoviePlayerController通知MPMoviePlayerLoadStateDidChangeNotification, MPMovieDurationAvailableNotification, MPMoviePlayerPlaybackStateDidChangeNotification, MPMoviePlayerReadyForDisplayDidChangeNotification来跟踪视频服务质量.但是现在使用AVPlayerViewController我找不到这些通知的正确替换.
如何立即替换这些通知?
mpmovieplayercontroller ios avplayer ios9 avplayerviewcontroller
我有UITableView的问题.它之后不会隐藏滚动指示器:
1)快速滚动
2)然后击中桌子的顶部或底部.
这是一个截图.

如何确保滚动指示器按预期正确隐藏?
请注意,弹跳已关闭.我也不想隐藏滚动指示器,我只是希望它在滚动停止在顶部或底部时按预期消失.
编辑:此问题似乎是由视图控制器设置automaticallyAdjustsScrollViewInsets为false.似乎需要设置以下3件事来重现问题:
1)表视图弹跳需要关闭
2)视图控制器设置automaticallyAdjustsScrollViewInsets为false(这是为了解决滚动指示器看起来不正确的另一个问题)
3)UIViewController本身的视图不应该是表视图,表视图必须是子视图.
在viewDidLoad那将看起来像这样:
self.view_table = [[UITableView alloc] initWithFrame:self.view.frame];
self.view_table.bounces = false;
self.automaticallyAdjustsScrollViewInsets = false;
Run Code Online (Sandbox Code Playgroud)
此外,表格视图的内容需要大于其框架的高度.
我正在实现一个使用webview播放视频文件的服务.我从UIWebView迁移到WKWebView,并试图用它播放Youtube和Coub视频.几乎所有东西都没问题,在iOS 8中没有崩溃,但是在WKWebView发布并从屏幕上移除后,视频声音会持续播放一段时间(在某些情况下大约需要45秒).
我找不到停止视频声音的方法.我试图通过媒体播放器捕获系统通知,但没有成功.
有没有办法在WKWebView中停止声音或视频?
WKWebview配置如下:
//javascript for configurate video viewport (not full screen)
NSString *jScript = [NSString stringWithFormat:@"var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=%d, height=%d, initial-scale=1, maximum-scale=1'); document.getElementsByTagName('head')[0].appendChild(meta);", (int)VIEW_WIDTH, (int)VIEW_HEIGHT ];
WKUserScript *wkUScript = [[WKUserScript alloc] initWithSource:jScript injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
WKUserContentController *wkUController = [[WKUserContentController alloc] init];
[wkUController addUserScript:wkUScript];
WKWebViewConfiguration *config = [WKWebViewConfiguration new];
config.mediaPlaybackAllowsAirPlay = YES;
config.userContentController = wkUController;
_wkWebView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, VIEW_WIDTH, VIEW_HEIGHT) configuration:config];
[_wkWebView setBackgroundColor:RGB(0x0a0a0a)];
[_wkWebView setNavigationDelegate:self];
[self insertSubview:_wkWebView atIndex:0];
Run Code Online (Sandbox Code Playgroud)