小编iPh*_*Dev的帖子

有没有办法在编辑UITableView时隐藏" - "(删除)按钮

在我的iphone应用程序中,我有一个处于编辑模式的UITableView,其中只允许用户对行进行重新排序,不给出删除权限.

那么有什么方法可以隐藏TableView中的" - "红色按钮.请告诉我.

谢谢

iphone cocoa uitableview ios

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

突出显示时更改UIButton的背景颜色

嗨,我想更改用户点按按钮的UIButton背景颜色.

我使用渐变显示背景颜色,当用户点击我需要更改渐变颜色.

[btn setTitle: @"Next" forState:UIControlStateNormal];
CAGradientLayer *gradient = [CAGradientLayer layer];            
gradient.frame = btn.bounds;
gradient.cornerRadius = 10.0f;
locations = [[NSArray alloc] initWithObjects: 0.0f, 0.0f, 0.0f,0.0f, nil]; 
[gradient setLocations:locations];
colorNext = [[NSArray alloc] initWithObjects:…., nil]; 
gradient.colors = colorNext;
[locations release];
[btn.layer insertSublayer:gradient atIndex:0];
btn.titleLabel.textColor = [UIColor blackColor];
Run Code Online (Sandbox Code Playgroud)

iphone uibutton

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

有没有办法在目标c中合并两个NSMutableArray?

我有两个NSMutableArray填充数据对象.如果发现任何更改,如何比较数组和合并.

例如: Array1= index(0) userName = {'a',1,'address'} index(1) userName = {'b',2,'address'}

Array2= index(0) userName = {'c',3,'address'} index (1) userName = {'b',2,'address'}

结果是: Array= index(0) userName = {'a',1,'address'} index (1) userName = {'b',2,'address'} index(2) userName = {'c',3,'address'}

请帮忙

objective-c

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

performSelector,performSelectorOnMainThread和performSelectorInBackground之间的区别

有什么区别

performSelectorOnMainThread

performSelectorInBackground

performSelector

谢谢

iphone

9
推荐指数
1
解决办法
3992
查看次数

如何在 angular js 中的 jasmine Specs 中模拟 Blob 和 Click()

如何为 Blob 和 Click() 事件编写 Jasmine 规范。每次我运行 Specs 时都会下载它的下载文件。我可以嘲笑这个(以及浏览器)。

谢谢

var csvFile = "a,b,c",filename="abc.csv";

var blob = new Blob([csvFile], { type: 'text/csv;charset=utf-8;' });
        if (navigator.msSaveBlob) { // IE 10+
            navigator.msSaveBlob(blob, filename);
        } else {
            var link = document.createElement("a");
            if (link.download !== undefined) { // feature detection
                // Browsers that support HTML5 download attribute
                var url = URL.createObjectURL(blob);
                link.setAttribute("href", url);
                link.setAttribute("download", filename);
                link.style.visibility = 'hidden';
                document.body.appendChild(link);
                link.click();
                document.body.removeChild(link);
            }
        }


describe("Should check download CSV", function() {
  it("file name should be 7 …
Run Code Online (Sandbox Code Playgroud)

unit-testing specs jasmine angularjs

6
推荐指数
0
解决办法
3215
查看次数

如何从iphone发送文件(txt/XML)到服务器(web或电子邮件)

嗨,我想从iphone发送文本或XML到另一台桌面计算机.有什么方法可以使用Email将文件作为附件发送,或者可以通过HTTP POST方法发送它.

请帮我.

email iphone attachment

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

我怎样才能知道iphone中的当前viewcontroller名称

我有BaseView实现UIViewController.项目中的每个视图都必须实现此BaseView.

在BaseView中,我有方法:

-(void) checkLoginStatus
{
    defaults = [[NSUserDefaults alloc] init];

    if(![[defaults objectForKey:@"USERID"] length] > 0 )
    {
        Login *login=[[Login alloc] initWithNibName:@"Login" bundle:nil];
        [self.navigationController pushViewController:login animated:TRUE];
        [login release];
    }
    [defaults release];
}
Run Code Online (Sandbox Code Playgroud)

问题是我的Login视图还实现了BaseView,检查登录,然后再次打开LoginView即插入递归调用.

我是否可以检查checkLoginStatus方法,如果请求来自LoginView,则不采取任何其他操作检查登录.例如:

- (void) checkLoginStatus
{
    **if(SubView is NOT Login){** 
        defaults = [[NSUserDefaults alloc] init];

        if(![[defaults objectForKey:@"USERID"] length] > 0 )
        {
            Login *login=[[Login alloc] initWithNibName:@"Login" bundle:nil];
            [self.navigationController pushViewController:login animated:TRUE];
            [login release];
        }
        [defaults release];
    }
}
Run Code Online (Sandbox Code Playgroud)

请帮忙..

iphone objective-c uiviewcontroller

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

如何设置在iPhone上以编程方式选择的第一个TabBar

UITabBar在视图中有5个标签.我正在使用didSelectItem委托打开不同的视图,即我不使用TabBarController.

我的问题是在视图加载我需要第一个选项卡默认选中.TabBar中是否有任何属性可以设置为选中它?

谢谢.

objective-c uitabbar ios swift

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

需要在iPhone中仅显示带有日期UIDatePicker的工作日

有没有什么办法,只显示一周的一天,日期为:MON 03-JULUIDatePicker以iPhone.

请帮忙.

iphone uidatepicker nsdateformatter ios

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

在iPhone中动画时获取图像的帧坐标

我正在使用SnowFall应用程序,其中图像从屏幕顶部下降到底部.这个应用程序使用动画来完成这项任务.

//把片放在我们的主视图中[self.view addSubview:flakeView];

[UIView beginAnimations:nil context:flakeView];
// set up how fast the flake will fall
[UIView setAnimationDuration:4 * speed];

// set the postion where flake will move to
//flakeView.frame = CGRectMake(endX, 500.0, 25.0 * scale, 25.0 * scale);
flakeView.frame = CGRectMake(endX, 500.0,16, 16);

// set a stop callback so we can cleanup the flake when it reaches the
// end of its animation
[UIView setAnimationDidStopSelector:@selector(onAnimationComplete:finished:context:)];
[UIView setAnimationDelegate:self];
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)

我的问题是我需要捕捉它们移动的图像帧.

有什么办法可以让我找到屏幕上图像的当前位置.

谢谢

编辑:我正在尝试使用:CGRectIntersectsRect(frame1,frame2)其中frame1是动画的图像,frame2是一个对象.如果图像与物体相交,我必须要做一些事情.

iphone animation

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

在iPhone中的NSMutableArrary中排序

我正在解析XML并以Dictionary的形式将所有数据存储在NSMutableArray中.

NSMutableArray * stories;   

// a temporary item; added to the "stories" array one at a time,
// and cleared for the next one
NSMutableDictionary * item;

- (void)parser:(NSXMLParser *)parser
 didEndElement:(NSString *)elementName
  namespaceURI:(NSString *)namespaceURI 
 qualifiedName:(NSString *)qName
{       
    if ([elementName isEqualToString:@"item"])
    {
        // save values to an item, then store that item into the array...
        [item setObject:currentTitle forKey:@"title"];
        [item setObject:currentLink forKey:@"link"];
        [item setObject:currentSummary forKey:@"summary"];
        [item setObject:currentDate forKey:@"date"];

        //Numeric value for sorting
        [item setObject:rates forKey:@"rates"];

        [stories addObject:[item copy]];    
    }
}
Run Code Online (Sandbox Code Playgroud)

完成解析后,我需要按"rate"排序数组,这是数字字段.请建议.

sorting iphone cocoa cocoa-touch objective-c

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

在iphone中的UIImagePicker内存泄漏

在我的应用程序中,用户可以拍摄来自相机的照片,所以三次拍照后它就崩溃了.我无法调整图像大小(其要求).那么还有其他方法可以避免内存泄漏.

谢谢

iphone uiimagepickercontroller

0
推荐指数
1
解决办法
1785
查看次数

iOS中的动画条形图

我正在画一个条形图,它工作正常,除了它有动画.例如:填充颜色0-50%.我使用简单的DrawRect方法绘制这里是我的代码:

- (void)drawRect:(CGRect)rect
{
    CGFloat height = self.bounds.size.height;
CGContextRef context = UIGraphicsGetCurrentContext();
// CGContextClearRect(context, rect);
CGContextSetFillColorWithColor(context, [self colorWithR:149 G:21 B:29 A:1].CGColor);

CGFloat barWidth = 52;
int count = 0;
NSNumber *num = [NSNumber numberWithFloat:graphValue];

CGFloat x = count * (barWidth + 10);
CGRect barRect = CGRectMake(x, height - ([num floatValue] * height), barWidth, [num floatValue] * height);
CGContextAddRect(context, barRect);
count++;

CGContextFillPath(context);

}
Run Code Online (Sandbox Code Playgroud)

请帮我知道添加动画的简单方法.

core-graphics ios

-1
推荐指数
1
解决办法
1146
查看次数