关于iPhone上的UISegmentedControl类的快速问题.
希望有些人可能已经注意到,在具有2个段的默认状态下,即使用户点击当前选择的段,分段控件仍将切换.
我在应用中看到了UISegmentedControls否定了这种行为,并且在用户按下选定的段时不进行切换.即,Apple的iTune Store应用程序.
是否有一种简单的方法可以防止我忽略这种行为,或者我是否需要在valueChanged中写入一些逻辑?
我一直试图禁用当前选定的段并启用未选择的段,但这似乎改变了控件的外观,当我不希望它.
有任何想法吗?
我见过iPhone上的应用程序,如果在3.0上运行,将使用3.0功能/ API,如应用程序内电子邮件编写器,如果在2.x上运行不使用这些功能,并退出应用程序以启动Mail.
这是怎么做到的?
我最初的想法是使用
#ifdef __IPHONE_3_0
Run Code Online (Sandbox Code Playgroud)
但这只有在我真正针对3.0 SDK构建应用程序时才会起作用 - 这会阻止它在2.x手机上运行.
此外,运行这个想法,应用程序必须与3.0 SDK链接,以获得3.0 API ...
我对它是如何实现有点困惑.
我的iPhone应用程序使用SHA1通过即时消息传递协议实现密码安全性.
当我将其提交给Apple的审核流程时,是否需要将我的应用声明为"包含加密"?
我正在尝试编译ZeroMQ C绑定以便能够在iPhone上使用它,这是我的配置选项:
./configure --host=arm-apple-darwin --enable-static=yes --enable-shared=no CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1 CFLAGS="-pipe -std=c99 -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=3.1.2 -gdwarf-2 -mthumb -I/Library/iPhone/include -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk -mdynamic-no-pic" CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cpp AR=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar AS=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/as LIBTOOL=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool STRIP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/strip RANLIB=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib
它实际上配置和编译很好,但是当我将它添加到Xcode Frameworks部分时,我收到警告:ld: warning: in /path/to/app/libzmq.a, file was built for unsupported file format which is not the architecture being linked (armv7)并且发现很多符号错误.
如果我将当前活动架构从armv6更改为armv7,警告消息会将其更改为armv6.我究竟做错了什么 ?
谢谢,丹
我已经提交了我的应用程序,它支持常规和视网膜显示版本.
我忘了放一个普通的图像文件(a.png),但它有(a@2x.png)Retina图像.
是普通iPhone能够显示(a@2x.png)图像吗?
我没有任何线索,因为我没有3GS或iPod Touch,但在iPhone常规模拟器上出来显示该图像.
有经验吗?
谢谢.
我遇到了一些代码,它们围绕括号中方法/函数的返回值.
那是做什么的?
我看到的代码拍了一张图片,调整了大小然后又返回了.
- (UIImage *)resizeImage:(UIImage *)image
{
//
// some fascinating, but irrelevant, resizing code here
//
return (image);
}
Run Code Online (Sandbox Code Playgroud) 我正在使用以下代码为UITableViewCell创建渐变背景.虽然这适用于普通表格单元格,但渐变仅出现在分组表格单元格的左右角落.就好像然后应用渐变一样,细胞被绘制在它上面.
有人可以建议修改代码,这对分组表格单元格有效吗?或者有一种完全不同的方式吗?
- (void)drawRect:(CGRect)rect {
CGContextRef c = UIGraphicsGetCurrentContext();
CGGradientRef myGradient;
CGColorSpaceRef myColorspace;
size_t num_locations = 2;
CGFloat locations[2] = {0.0, 1.0};
CGFloat components[8] = {0.8f, 0.8f, 0.8f, 1.0f, // Bottom Colour: Red, Green, Blue, Alpha.
0.9f, 0.9f, 0.9f, 1.0}; // Top Colour: Red, Green, Blue, Alpha.
myColorspace = CGColorSpaceCreateDeviceRGB();
myGradient = CGGradientCreateWithColorComponents (myColorspace, components,
locations, num_locations);
CGColorSpaceRelease(myColorspace);
CGPoint startPoint, endPoint;
startPoint.x = 0.0;
startPoint.y = self.frame.size.height;
endPoint.x = 0.0;
endPoint.y = 0.0;
CGContextDrawLinearGradient (c, myGradient, startPoint, endPoint, 0);
const …Run Code Online (Sandbox Code Playgroud) 我在UITableView的headerView中显示iAd.当用户滚动时,iAd消失,因为headerView不再可见.我不确定这是否会阻止我的应用被接受.
在switch语句中使用Objective-C对象时出现编译器错误:
switch (myConstant)
{
case 0:
UIViewController *myController = [[[UIViewController alloc] init] autorelease];
[self.navigationController pushViewController:myViewController animated:YES];
break;
case 1:
// stuff
break;
default:
break;
}
Run Code Online (Sandbox Code Playgroud)
错误说明:
'UIViewController''myViewController'
未声明之前的预期表达式(首次在此函数中使用)
我知道第二个错误是第一个错误的直接结果,但我不明白的是为什么我首先得到'预期表达式'错误...
如果我;在行的末尾添加一个case 0:,那么它将编译,但我不应该这样做,不是吗?
这也将无法编译,具有相同的错误:
switch (0)
{
case 0:
int a = 0;
break;
default:
break;
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我声明int a;切换块的外部,那么a = 0;编译正常.
我以为我理解转换语句 - 显然我没有.有人可以解释一下吗?
我有一个小问题.
我需要使用一个句子,它将前两个单词加粗,最后两个单词为斜体.
就像我正在使用 O bjective C Developer.
怎么做.这在目标C中是否可行?
问候,
objective-c ×7
iphone ×6
c ×2
cocoa-touch ×2
ios ×2
app-store ×1
compilation ×1
configure ×1
encryption ×1
iad ×1
ios4 ×1
ipad ×1
parentheses ×1
return-value ×1
sha1 ×1
syntax ×1
uikit ×1
uitableview ×1
xcode ×1
zeromq ×1