标签: xcode4

从RGB到HSV的UIColor转换,将亮度设置为UIColor

在我的应用程序中,我试图用不同的颜色绘制.我有自己的颜色选择器,但我想添加到此选择器滑块以获得颜色亮度.对于底层测试:我选择一种在视图中作为背景颜色显示的颜色,并且我希望添加滑块,它将从1滑动到0并改变颜色的亮度并在窗口中显示颜色.因此,我想询问是否有任何可能的转换方法.

在我的项目中我用这个:

CGContextSetRGBStrokeColor(current, R, G, B, A);
Run Code Online (Sandbox Code Playgroud)

所以当我滑动滑块时,我需要更改颜色的亮度,因此我需要将我的UIColor- 表示为RGB 转换为HSV而不是返回RGB再次使用它.

是否存在任何RGB到HSV转换算法,或者在iOS 5或Xcode4中是否存在?

uicolor xcode4 ios5

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

如何更新NSMutableDictionary

我有

NSMutableDictionary *mutDic;
Run Code Online (Sandbox Code Playgroud)

NSMutableDictionary 从一个警报中加载了一些来自我试图更新其值的警报值

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    [self.mutDic setValue:[[alertView textFieldAtIndex:0] text] forKey:@"lname"];
}
Run Code Online (Sandbox Code Playgroud)

但我得到了这个例外

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object'
Run Code Online (Sandbox Code Playgroud)

我们如何更新字典?

iphone nsmutabledictionary xcode4

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

登录检查后执行Segue

我对iphone的发展有些新意,所以请耐心等待!

我有一个登录屏幕,连接到我开发的REST API.它来回发送json请求.基本上,当您单击LOGIN时,它会检查用户名/密码是否有效(显然).

这是我所拥有的基本逻辑:

- (IBAction)sendLoginJson:(id)sender {

   // send JSON request to server.. etc

   NSURLConnection *myConnection = [NSURLConnection connectionWithRequest:request delegate:self];
   [myConnection start]; 
}
Run Code Online (Sandbox Code Playgroud)

然后去

- (void)connectionDidFinishLoading
   // this is where I get the response from the server
Run Code Online (Sandbox Code Playgroud)

在确保正确验证登录后,如何切换到"DashboardViewController"?

谢谢!

iphone storyboard xcode4 ios5 segue

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

在命令行xcodebuild调用之后分发.app文件

我正在构建/存档我的Mac应用程序以便从命令行调用(下面)进行分发,并安装了Xcode 4.3.为了清楚起见,我之前没有为Xcode 4.3提供解决此问题的工作解决方案,因此对早期Xcode版本的建议很容易仍然有效.这是电话:

/usr/bin/xcodebuild -project "ProjectPath/Project.pbxproj" -scheme "Project" -sdk macosx10.7 archive
Run Code Online (Sandbox Code Playgroud)

这成功运行,它生成一个.xcarchive位于我的~/Library/Developer/Xcode/Archives/<date>文件夹中的文件.获取存档文件生成路径的正确方法是什么?我正在寻找一种方法来获取.app其中包含的文件的路径,因此我可以分发它.

我已经查看了MAN页面xcodebuild(并在网上进行了大量搜索)并且没有找到任何线索.

macos command-line build-process build xcode4

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

当我在tableview中点击一行时,关闭popover

我正在使用Popover控制器,我在单击按钮时创建一个弹出控件,然后导航到类,在弹出类中显示一个表视图.

在这里,我想在点击表格视图行时忽略弹出窗口.

这是我的代码:

//popoverclass.h
UIPopoverController *popover; 
@property(nonatomic,retain)IBOutlet UIPopoverController *popover;

//popoverclass.m
-(IBAction)ClickNext
{
    ClassPopDismiss *classCourse = [[ClassPopDismiss alloc] init];
    popover = [[UIPopoverController alloc] initWithContentViewController:classCourse];
    popover.delegate = self;
    [popover presentPopoverFromRect:CGRectMake(50,-40, 200, 300) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
    [classCourse release];

}

//ClassPopDismiss.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    PopOverClass *objclass=[[PopOverClass alloc]init];
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
  [objclass.popover dismissPopoverAnimated:YES];

}
Run Code Online (Sandbox Code Playgroud)

上面的代码不起作用.

iphone objective-c uipopovercontroller ios xcode4

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

使用可可检测未决的系统关闭

如何检测计算机何时因可可关机而关闭?互联网上似乎没有任何东西。这必须区分关闭和注销。

有人可以帮我吗?

macos cocoa shutdown osx-snow-leopard xcode4

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

Xcode语义问题"Initializer元素不是编译时常量"

调用NSMakeRange方法时出现此错误.我做错了什么?

#import <Foundation/Foundation.h>
//
NSRange range1 = NSMakeRange(12, 5);
Run Code Online (Sandbox Code Playgroud)

objective-c xcode4

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

CppUTest示例构建失败

我是mac的新手!我下载了xcode4.2并尝试构建CppUTest-v3

1)当我做的时候,我有以下日志

compiling AllTests.cpp
compiling AllocationInCppFile.cpp
compiling CheatSheetTest.cpp
compiling CommandLineArgumentsTest.cpp
compiling CommandLineTestRunnerTest.cpp
compiling JUnitOutputTest.cpp
compiling MemoryLeakDetectorTest.cpp
compiling MemoryLeakOperatorOverloadsTest.cpp
compiling MemoryLeakWarningTest.cpp
compiling NullTestTest.cpp
compiling PluginTest.cpp
compiling PreprocessorTest.cpp
compiling SetPluginTest.cpp
compiling SimpleStringTest.cpp
compiling TestFailureTest.cpp
compiling TestFilterTest.cpp
compiling TestHarness_cTest.cpp
compiling TestInstallerTest.cpp
compiling TestMemoryAllocatorTest.cpp
compiling TestOutputTest.cpp
compiling TestRegistryTest.cpp
compiling TestResultTest.cpp
compiling UtestTest.cpp
compiling AllocationInCFile.c
compiling TestHarness_cTestCFile.c
compiling CommandLineArguments.cpp
compiling CommandLineTestRunner.cpp
compiling JUnitTestOutput.cpp
compiling MemoryLeakDetector.cpp
compiling MemoryLeakWarningPlugin.cpp
compiling SimpleString.cpp
compiling TestFailure.cpp
compiling TestFilter.cpp
compiling TestHarness_c.cpp
compiling TestMemoryAllocator.cpp
compiling TestOutput.cpp
compiling TestPlugin.cpp
compiling TestRegistry.cpp
compiling TestResult.cpp …
Run Code Online (Sandbox Code Playgroud)

xcode4 cpputest

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

单击返回按钮后如何使键盘消失

可能重复:
如何在iPhone上制作返回键使键盘消失?

我正在处理的页面中有两个文本字段.单击返回后,只有第一个文本字段消失,但它不适用于第二个文本字段.

以下是我的.m文件中的方法:

-(void) viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated]; 
    self.cardNameTextField.delegate = self;    
    self.pinTextField.delegate = self;
}

-(BOOL) textFieldShouldReturn:(UITextField *)textField
{    
    if (_cardNameTextField !=nil)
    {
        [self.cardNameTextField resignFirstResponder];
    }
    else if (_pinTextField !=nil)
    {      
        [self.pinTextField resignFirstResponder];
    } 
    return YES;
}
Run Code Online (Sandbox Code Playgroud)

建议请:)

iphone objective-c xcode4 ios5

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

为iPhone本地化图像的最佳方法是什么?

我打算本地化我的iPhone应用程序,包括9种其他语言,除了英语.

我担心的是,我有许多.png带文本的文件,以及@2x用于视网膜显示的各自图像.

现在我的应用程序有5.6Mb,我担心它包含其他9种语言的每个文件.png@2x文件之后会比它重得多.

根据你的经验,这是真的吗?在将其本地化为其他9种语言后,我最终会得到更大的应用程序吗?

iphone cocoa-touch localization ios xcode4

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