我有一个包含10个元素的数组,这些元素称为产品,默认排序,这是当前的日志.
for (int i=0;i<products.count; i++)
{
NSLog(@"%@",products[i]);
}
Run Code Online (Sandbox Code Playgroud)
输出:
Product1
Product10
Product2
Product3
Product4
Product5
Product6
Product7
Product8
Product9
Run Code Online (Sandbox Code Playgroud)
我需要按以下顺序对其进行排序:
Product1
Product2
Product3
Product4
Product5
Product6
Product7
Product8
Product9
Product10
Run Code Online (Sandbox Code Playgroud)
我目前的方法是扫描数字并根据它进行排序,我想知道在iOS中是否有任何其他方法或默认方法可以做到这一点,或者我是否必须坚持使用我当前扫描每个元素中的数字的方法然后排序?
我有一个非常奇怪的要求......
我需要启动我的应用程序,例如,在SMS中收到的超链接.
这可以以某种方式完成吗?
我的意思是,收到短信的人只需点击"特殊短信"中提供的链接,即可启动该应用程序.
类似于在设备中调用应用程序的特殊链接......
我偶然发现了一篇文章,该文章展示了如何在iOS4中以编程方式创建和发送邮件正文,我认为这可能有助于我创建"特殊邮件"
所以创建邮件可能不是问题...: |
它是调用部分......
任何人都知道可以做什么?
建议和示例代码非常感谢... :)
提前感谢!
我以编程方式创建了一个WebView.这很完美.代码如下.我现在需要尝试做的就是注入NSStrings它.我有一个30个字符串的数组.15个标题和15个正文.
是否可以在WebView中显示这些内容?我猜我需要将它们改成HTML,我可能会将它们全部重新格式化为NSStringHTML标签和换行符以及newling-tags吗?
有人能帮我一些指针/代码片段,让我走上正确的轨道并转向正确的方向吗?
- (void) initUIWebView
{
aWebView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 290)];//init and
create the UIWebView
aWebView.autoresizesSubviews = YES;
aWebView.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
[aWebView setDelegate:self];
NSString *urlAddress = @"http://www.google.com"; // test view is working with url to webpage
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[aWebView loadRequest:requestObj];
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 300)];
[[self view] addSubview:aWebView];
}
Run Code Online (Sandbox Code Playgroud)
谢谢-Code
我有NSArray.我在那个数组里面有一些价值.
NSArray *testArray = [NSArray arrayWithObjects:@"Test 1", @"Test 2", @"Test 3", @"Test 4", @"Test 5", nil];
NSLog(@"%@", testArray);
Run Code Online (Sandbox Code Playgroud)
结果如下:
(
"Test 1",
"Test 2",
"Test 3",
"Test 4",
"Test 5"
)
Run Code Online (Sandbox Code Playgroud)
现在我想要这样的结果:
(
"Test 3",
"Test 5",
"Test 1",
"Test 2",
"Test 4"
)
Run Code Online (Sandbox Code Playgroud)
有没有办法在不重新初始化阵列的情况下做到这一点?我可以交换这个数组的值吗?
是否可以使用麦克风在模拟器上录制实际声音.
我创建了录音机,它在模拟器中录制声音但不录制实际音频,它只是空(空)音频.
我正在尝试将文件夹从应用程序包复制到iphone文档目录,但它没有发生.
我用过这个代码
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *sourcePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Photos"];
NSArray *paths1 = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths1 objectAtIndex:0];
NSError *error1;
NSArray *resContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:sourcePath error: &error1];
if (error1) {
NSLog(@"error1 : %@",error1);
}
[resContents enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop)
{
NSError* error;
if (![[NSFileManager defaultManager]
copyItemAtPath:[sourcePath stringByAppendingPathComponent:obj]
toPath:[documentsDirectory stringByAppendingPathComponent:obj]
error:&error])
NSLog(@"%@", [error localizedDescription]);
}];
}
Run Code Online (Sandbox Code Playgroud)
并尝试了这种方法
- (void)viewDidLoad{
[self copyFolder];
}
- (void) copyFolder {
BOOL success1;
NSFileManager *fileManager1 = …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用这个类
AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL: fileURL error: nil];
Run Code Online (Sandbox Code Playgroud)
并获得此编译器错误
error: AVAudioPlayer.h no such file or directory
Run Code Online (Sandbox Code Playgroud)
我已经#import "AVAudioPlayer.h在.m文件的开头添加了
你能告诉我怎么解决这个问题吗?
谢谢
我正在使用以下代码
[UIView animateWithDuration:1.0
delay:0.05
options:UIViewAnimationCurveEaseIn
animations:^{
//Code
} completion:^(BOOL finished) {}];
Run Code Online (Sandbox Code Playgroud)
我收到以下警告
Implicit conversion from enumeration type 'enum UIViewAnimationCurve' to different enumeration type 'UIViewAnimationOptions' (aka 'enum UIViewAnimationOptions')
Run Code Online (Sandbox Code Playgroud)
怎么解决这个?
objective-c uiview uiviewanimation ios uiviewanimation-curve
我有一个500列和100M行的大表.基于一个小样本,我相信只有大约50个列包含任何值,而另一个450只包含NULL值.我想列出不包含数据的列.
在我当前的硬件上,查询每列需要大约24小时(select count(1) from tab where col_n is not null)
是否有一种较便宜的方法来确定列是否完全为空/ NULL?
我CADisplayLink在我的iPhone应用程序中使用.
这是相关代码:
SMPTELink = [CADisplayLink displayLinkWithTarget:self selector:@selector(onTick)];
SMPTELink.frameInterval = 2;//30fps 60/n = fps
[SMPTELink addToRunLoop:[NSRunLoop mainRunLoop]
forMode:NSDefaultRunLoopMode];
Run Code Online (Sandbox Code Playgroud)
因此onTick被称为30FPS(1/30秒)的每一帧.这在iOS6+上很有效 - 完全符合我的需要.但是,当我在运行iOS5.1的iPhone 4s上运行我的应用程序时,onTick方法的运行速度比使用iOS6版本略慢.几乎就像是在运行它29FPS.稍微过了一点,它与iOS6 iPhone 5不同步.
onTick方法中的代码并不耗时(这是我的一个想法...),而且它不是iPhone,因为应用程序在运行iOS6的iPhone 4上运行良好.
请问CADisplayLink功能不同的iOS5.1?任何可能的解决方法/解决方案?