小编Irf*_*fan的帖子

iOS如何获取,当前在cellForRowAtIndexPath方法中选择了indexpath行?

我想在表格的每个单元格中使用标签建立链接.

单击链接时,表将获取单元格的[indexpath行],我们将使用索引与包含字符串数据的数组索引匹配.该字符串将被发送到下一个推送页面.

我正在使用UITapGestureRecognizer来点击标签并将参数放入选择器方法.

如何获取当前索引路径行所选单元格上的标签?这是我的示例代码:

 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
...
UITapGestureRecognizer *gestureRec = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(openUrl:) ];
gestureRec.numberOfTouchesRequired = 1;
gestureRec.numberOfTapsRequired = 1;
[cell.listPrice addGestureRecognizer:gestureRec];
[gestureRec release];
...
}


- (void)openUrl:(id)sender
{
NSLog(@"DOwnload URL send >> %@",urlDownloadSend);
DownloadNowController *download =[[DownloadNowController alloc]initWithNibName:@"DownloadNowController" bundle:nil];
[self.navigationController pushViewController:download animated:YES];
[download release]; 
}
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uitableview uigesturerecognizer ios

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

滚动到底部时,iOS 无法看到自定义表格单元格的最后几行。

目前我有一个 UITableview,我有足够的数据无法完全显示在屏幕上,因此用户必须滚动表格视图。

我看到的问题是,当我一直滚动到底部时,表格视图中显示的最后一个元素并不是真正的最后一个元素,但是,如果我进行触摸拖动,并尝试将其向下拖动,我可以看到最后一个元素,但是如果我松开手指,滚动会弹回到底部显示的元素,而不是最后一个元素

如何确保 tableview 滚动大小与容器的高度相同?

我确实覆盖了这两种方法:

- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
 - (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section
Run Code Online (Sandbox Code Playgroud)

我会做:

- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
Run Code Online (Sandbox Code Playgroud)

真的很高,但是当向下滚动到底部时,它仍然不是最后一个元素。

custom-controls uitableview uiscrollview ios

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

更改导航栏色调iOS 7.

我知道如何在iOS 6中更改导航棒色调颜色:

[UINavigationBar appearance].tintColor = [UIColor colorWithRed:129/255.0 green:200/255.0 blue:244/255.0 alpha:1.0];
Run Code Online (Sandbox Code Playgroud)

我在APPDelegate页面中添加此代码.现在我想在iOS 7中执行此操作,但上面的代码无效.我在网上搜索.我有一个解决方案.通过在每个页面添加以下功能,我可以更改导航颜色.

self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:129/255.0 green:200/255.0 blue:244/255.0 alpha:1.0];
Run Code Online (Sandbox Code Playgroud)

但我需要一个可以添加到APPDelegate功能的功能.请帮我解决这个问题.

uinavigationbar uicolor ios appdelegate ios7

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

Xposed:如何在 xposed 框架中挂钩嵌套类(内部类)的方法。

我正在尝试使用以下方法挂钩方法:

 findAndHookMethod("com.android.keyguard.KeyguardPatternView.UnlockPatternListener", lpparam.classLoader, "onPatternDetected", new XC_MethodHook()
Run Code Online (Sandbox Code Playgroud)

其中 UnlockPatternListener 是一个嵌套类(内部类),它有一个名为 onPatternDetected 的方法。内部类是私有的。

我无法挂钩此方法。你能告诉我怎么做吗?

android nested systems-programming

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

Xcode建立在Debug上,但不是Release

所以,我在尝试构建项目时遇到了这个问题.

目前如果我在调试模式下运行项目,它运行正常,应用程序在设备上启动,我可以测试东西.

然而,奇怪的部分是当我切换到Release版本并尝试在设备上构建时.当我按下运行按钮Xcode正常构建并且构建成功通知甚至弹出,但然后我得到此错误代码.

让我们调用我的应用程序xxx

无法启动"xxx.app"

没有相应的文件和目录:

/Users/*my Name*/Library/Developer/Xcode/DerivedData/*Bunch of xcode folders*/Products/Release-iphoneos/xxx.app/xxx
Run Code Online (Sandbox Code Playgroud)

我进入了查找器并搜索了xxx.app并找不到它.此外,在/ Users/my Name/下甚至不存在Library文件夹.

那么xcode试图在这做什么,我该怎么做才能解决这个问题?

编辑:我也尝试过清理项目并再次构建,错误代码仍然出现.

debugging release objective-c build-settings ios

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

iOS从当前日期开始一个月.

我想从当前日期开始一个月.

以下是我所拥有的,它正在回归:4027-09-24 16:59:00 +0000.currentDate是对的.这是怎么回事?

// Get todays date to set the monthly subscription expiration date
NSDate *currentDate = [NSDate date];
NSLog(@"Current Date = %@", currentDate);
NSDateComponents *dateComponents = [[NSCalendar currentCalendar] components:NSMonthCalendarUnit | NSDayCalendarUnit | NSYearCalendarUnit fromDate:currentDate];
dateComponents.month = dateComponents.month + 1;
NSDate *currentDatePlus1Month = [[NSCalendar currentCalendar] dateByAddingComponents:dateComponents toDate:currentDate options:0];
NSLog(@"Date = %@", currentDatePlus1Month);
Run Code Online (Sandbox Code Playgroud)

calendar date nsdate nscalendar ios

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

滚动时UITableview滞后.

我正在尝试实现iOS 6日历中的事件表.

我有UITableView 500行(事件).当我开始滚动动画是顺利的.

但是在两百行开始滞后之后.在原生iOS 6日历事件列表中,所有工作都顺利进行

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    double begin = CFAbsoluteTimeGetCurrent();
    if(!self.isNoResults)
    {
        NSString *cellIdentifier = [NSString stringWithFormat: @"Cell %i %i", indexPath.row, indexPath.section];
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
        UIImageView *circleImgView;
        NSString *startTimeStr;
        NSDateFormatter *formatter;
        UILabel *timeLbl;
        UILabel *titleLbl;
        UILabel *endsLbl;
        UIImageView *eventTypeImgView;
        if(cell == nil)
        {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
            circleImgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"newMesIcon.png"]];
            circleImgView.frame = CGRectMake(14, 19, 12, 12);
            [cell.contentView addSubview:circleImgView];



            timeLbl = [[UILabel alloc] init];
            [timeLbl setBackgroundColor:[UIColor clearColor]]; …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview ios ios6

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

是否有任何选项可以在开放式服务器上禁用群聊消息历史记录?

我一直在创建group chat application,同时实现群聊功能我面临的问题,当我每次join the room, open fire sends last two days messages.

这是我每次加入房间时都会收到的帖子.

<message xmlns="jabber:client" id="05qEM-18" to="210@openfire.indianic.net/94e509b9" type="groupchat" from="top@conference.openfire.indianic.net/258"><body>Very good morning!!!</body><delay xmlns="urn:xmpp:delay" stamp="2014-03-19T05:15:06.542Z" from="258@openfire.indianic.net/Smack"/><x xmlns="jabber:x:delay" stamp="20140319T05:15:06" from="258@openfire.indianic.net/Smack"/></message>
Run Code Online (Sandbox Code Playgroud)

任何好友可以表明,哪里是选项disable history messageopen fire server?所以我只会收到一次消息.

提前致谢.

iphone chat xmpp openfire ios

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

代码签名未显示供应配置文件 - Xcode 5.1.

嗨,我最近升级到Xcode 5.1,现在我在Projects->Target->Code Signing设置部分找不到配置文件.在Xcode 5.1之前,我曾经使用Provisioning Profile选项将Provisioning Profile更改为所需的配置文件,然后它开始出现在代码签名身份调试或发布部分中,如下图所示.

在此输入图像描述

但是现在我没有在代码签名中给出这个选项,所以我无法更改调试或发布配置文件,它只显示自动或钥匙串中的身份.

我如何更改为所需的配置文件?

更新:

我尝试在用户定义的配置文件中使用000000B-0000-0000-0000-000000000000 UUID代码,它接受并构建并显示代码签名中的配置文件.但它没有解决用户定义的配置文件中的配置配置文件名称.

xcode objective-c ios provisioning-profile

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

更改文本后,无法更改UISearchBar取消按钮标题颜色.

我正在使用此代码更改UISearchBar取消按钮标题:

-(void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller{
self.searchDisplayController.searchBar.showsCancelButton = YES;
UIView* view=_otsinguRiba.subviews[0];
for (UIView *subView in view.subviews) {
    if ([subView isKindOfClass:[UIButton class]]) {
        UIButton *cancelButton = (UIButton*)subView;

        if (cancelButton) {
        [cancelButton setTitle:@"Test") forState:UIControlStateNormal];
        [cancelButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        }
    }
}
}
Run Code Online (Sandbox Code Playgroud)

虽然更改文本工作正常,但更改颜色不会.它保持黑色.

iphone objective-c uiview uisearchbar ios

3
推荐指数
1
解决办法
2637
查看次数