撕掉我的头发试图让它发挥作用.我想表演[self.tableView deleteRowsAtIndexPaths:indexes withRowAnimation:UITableViewRowAnimationLeft];,
我如何删除更详细的代码:
int index = (int)[self.messages indexOfObject:self.messageToDelete];
[self.messages removeObject:self.messageToDelete];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:index inSection:0];
NSArray *indexes = [[NSArray alloc] initWithObjects:indexPath, nil];
[self.tableView deleteRowsAtIndexPaths:indexes withRowAnimation:UITableViewRowAnimationLeft];
Run Code Online (Sandbox Code Playgroud)
这工作正常但是如果我收到推送通知(即收到新消息),删除应用程序将崩溃并显示如下错误:
断言失败 - [UITableView _endCellAnimationsWithContext:],/ SourceCache/UIKit/UIKit-3347.44/UITableView.m:1327 2015-07-04 19:12:48.623 myapp [319:24083]***由于未捕获的异常而终止应用程序' NSInternalInconsistencyException',原因:'尝试从更新前仅包含1行的第0部分删除第1行'
我怀疑这是因为我的数据源正在改变,数组的大小
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
Run Code Online (Sandbox Code Playgroud)
删除时的引用将不一致,因为当推送通知触发刷新时它会增加1.有什么方法可以解决这个问题吗?我是否正确deleteRowsAtIndexPaths使用该numberOfRowsInSection方法?
我想在UILabel上添加渐变效果,使它看起来像:

请注意左右角的渐变效果.我不知道如何做到这一点.任何帮助或建议将不胜感激.
编辑: - 我尝试使用此代码 -
UIColor *endColor = [UIColor colorWithRed:20/255.0 green:157/255.0 blue:189/255.0 alpha:1.0];
NSArray *gradientColors = [NSArray arrayWithObjects:(id)[[UIColor clearColor] CGColor],(id)[endColor CGColor], nil];
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.colors = gradientColors;
[gradientLayer setStartPoint:CGPointMake(0.0, 0.5)];
[gradientLayer setEndPoint:CGPointMake(1.0, 0.5)];
[self.rightLabel.layer insertSublayer: gradientLayer atIndex:0];
Run Code Online (Sandbox Code Playgroud)
但我变得喜欢:

注意:
添加渐变作为标签的背景,但我想要像第一张图像中那样的渐变效果(请参阅右下角的标签)
我试图实现DTCoreText.我按照本指南并将其实现为git submodul,但现在我在尝试运行我的应用程序时遇到错误.在片刻,我没有使用DTCoreText进行任何编码.我只是想测试我的应用程序是否适用于新导入的数据......但它没有!
我收到一个警告:
Static Library was rejected as an implicit dependency for 'libDTCoreText.a' because its architectures 'armv7s' didn't contain all required architectures 'armv7'
Run Code Online (Sandbox Code Playgroud)
在我看来,警告后出现以下错误的原因:
Apple Mach-O Linker Error: no such file or directory: '/Users/-------------/Build/Products/Debug-iphoneos/libDTCoreText.a'
Run Code Online (Sandbox Code Playgroud)
我没有忘记在" Link Binary With Libraries "中实现libDTCoreText.a ,但它总是红色的?这可能是问题吗?
我想覆盖self.navigationItem.backBarButtonItem的目标和行动,
我试过了:
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(backButtonOverrideAction:)];
[self.navigationItem setLeftBarButtonItem:backButton];
Run Code Online (Sandbox Code Playgroud)
它工作,但我想使用默认箭头:
我也尝试过:
UIBarButtonItem *backButton = self.navigationItem.backBarButtonItem;
[backButton setTarget:self];
[backButton setAction:@selector(backButtonOverrideAction:)];
Run Code Online (Sandbox Code Playgroud)
但不幸的是它不起作用..你知道怎么做吗?
你能告诉我,我如何通过 Google+ Javascript/Php api 获取用户数据(姓名、电子邮件)?我按照这个教程去,它描述了如何authResult['code']通过 Javascript获取。
没关系,我有。我通过 Ajax 将它发送到服务器,但我不知道如何通过 PHP BUT 获取用户数据,如姓名和电子邮件,而无需任何重定向。以下是 Javascript 代码示例:
function googleStart()
{
console.log('googleStart');
gapi.load('auth2', function()
{
auth2 = gapi.auth2.init({
client_id: '811214467813-v3fmui5dfghte5m0kmohsf6dl11ori3tg.apps.googleusercontent.com',
// Scopes to request in addition to 'profile' and 'email'
fetch_basic_profile: false,
scope: 'profile email'
});
});
}
function googleSignIn(authResult)
{
console.log(authResult);
if (authResult['code']) {
console.log(authResult);
// Hide the sign-in button now that the user is authorized, for example:
$('#signinButton').attr('style', 'display: none');
// Send the code to the server
$.ajax({ …Run Code Online (Sandbox Code Playgroud) ios ×4
objective-c ×4
core-text ×1
dtcoretext ×1
google-login ×1
google-oauth ×1
google-plus ×1
iphone ×1
php ×1
uilabel ×1
uitableview ×1