我正在尝试显示原始标签栏图像.以下代码在iOS7中运行正常,但是ios 6.0上面的代码崩溃了.以下是代码AppDelegates didFinishLaunchingWithOptions
UITabBar *tb = tabBarControllerProperty.tabBar;
NSArray *itemsObject = tb.items;
for(UITabBarItem *tabItem in itemsObject)
{
UIImage *imaged = tabItem.image;
tabItem.selectedImage = imaged;
tabItem.image = [imaged imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];// crash for ios6, not in ios 7
}
Run Code Online (Sandbox Code Playgroud) 我NSURL在ScanViewController课堂上有一个对象并将它传递给ListViewController类.
NSURL *url = [NSURL URLWithString:@"http:// some url"];
Run Code Online (Sandbox Code Playgroud)
我在我的项目中使用xib,但找不到替代品
[self.storyboard instantiateViewControllerWithIdentifier:]
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
{
if(error || !data)
{
NSLog(@"JSON NOT posted");
}
else
{
NSLog(@"JSON data posted!");
id jsonObject = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:Nil];
if([jsonObject respondsToSelector:@selector(objectForKey:)])
{
NSDictionary *dictionaryForUserID = [jsonObject valueForKey:@"ProjID"];
NSLog(@" Project Id = %@", dictionaryForUserID);
NSURL *urlToDisplayInListView = [NSURL URLWithString:[NSString stringWithFormat:@"http://some url/%@", dictionaryForUserID]]; **//Pass this object to other viewcontroller**
}
}
}];
Run Code Online (Sandbox Code Playgroud) 将数据发布到json Web服务后,我需要提醒用户数据是否已成功保存.我对此没有任何问题,但在日志中获得"数据已成功保存"响应后,视图需要很长时间(大约40-50秒)才能显示警报视图.我可以在几秒钟内得到响应后立即帮助我获取警报视图吗?这就是我所做的
NSURL *url = [NSURL URLWithString:@"some url"];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
NSData *requestData = [NSJSONSerialization dataWithJSONObject:dictionary options:kNilOptions error:&error];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%d", [requestData length]] forHTTPHeaderField:@"Content-Length"];
[request setHTTPBody: requestData];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
[connection start];
[NSURLConnection sendAsynchronousRequest:request queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error){
if(error || !data)
{
NSLog(@"JSON Data not posted!");
[activity stopAnimating];
UIAlertView *alertMessage = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Data not saved" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertMessage show]; …Run Code Online (Sandbox Code Playgroud) 我列出了来自Web Service的联系人,并将其显示在联系人的"sectionView"tableView中,如屏幕截图所示.

问题是,对于A部分和S部分,我获得了第一行复选框的相同标记值.我已经对一个数组进行了排序并显示在索引表视图中.如何根据indexPath.row获取不同的标记值,而不管显示的部分数量.这是我尝试过的
In cellForRowAtIndexPath:
UIButton *checkBox;
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
checkBox = [[UIButton alloc]initWithFrame:CGRectMake(7, 8, 30, 30)];
}
else
{
checkBox = [[UIButton alloc]initWithFrame:CGRectMake(15, 13, 30, 30)];
}
//int cnt = 0;
// for (int i = indexPath.section - 1; i > 0 ; i--)
// {
// cnt += [[objectsForCharacters objectForKey:[arrayOfCharacters objectAtIndex:i]] count]; //arrayOfCharachters has char 'A' to 'Z'
// }
//checkBox.tag = cnt + indexPath.row;
[checkBox setImage:[UIImage imageNamed:@"checkBox.png"] forState:UIControlStateNormal];
[checkBox addTarget:self action:@selector(checkBoxClicked:) forControlEvents:UIControlEventTouchUpInside];
[checkBox setTag:indexPath.row];
[cell.contentView addSubview:checkBox]; …Run Code Online (Sandbox Code Playgroud) 我在应用处于测试阶段时使用ad-hoc创建了.ipa文件.我想将此.ipa文件发送给我在其他国家的朋友测试应用程序,但由于公司政策,他无法越狱设备.如何制作可在任何iOS设备上执行的.ipa文件?
从Xcode 4.6生成的.ipa文件
完成此链接后,我的代码问题是输出图像无法设置正确的x和y值,因为裁剪后的图像似乎在结果图像中有0和0,无论我在哪里缩放(或计算滚动偏移的位置) .这是我尝试过的.
- (IBAction)crop:(id)sender
{
float zoomScale = 1.0f / [self.scroll zoomScale];
CGRect rect;
NSLog(@"contentOffset is :%f,%f",[self.scroll contentOffset].x,[self.scroll contentOffset].y);
rect.origin.x = self.scroll.contentOffset.x * zoomScale;
rect.origin.y = self.scroll.contentOffset.y * zoomScale;
rect.size.width = self.scroll.bounds.size.width * zoomScale;
rect.size.height = self.scroll.bounds.size.height * zoomScale;
UIGraphicsBeginImageContextWithOptions( CGSizeMake(rect.size.width, rect.size.height),
NO,
0.);
NSLog(@"rect offset is :%f,%f",rect.origin.x,rect.origin.y);
CGPoint point = CGPointMake(-rect.origin.x, -rect.origin.y); **//even though above NSLog have some values, but output image is unable to set proper x and y values as cropped image seems to have …Run Code Online (Sandbox Code Playgroud) 我有一个字符串
NSString *str = @"[\"a\" : \"b\" , \"c\" : \"d\", \"e\" : \"f\" ,]" ;
Run Code Online (Sandbox Code Playgroud)
我想删除逗号(,),即如果字符串只在字符串的末尾有逗号,则应该替换为像@""这样的空白字符.如果逗号出现在字符串的开头或中间,则不应删除它.所以最后的字符串应该是
["a" : "b" , "c" : "d", "e" : "f"]
Run Code Online (Sandbox Code Playgroud)
代替
["a" : "b" , "c" : "d", "e" : "f",]
Run Code Online (Sandbox Code Playgroud) ios ×7
objective-c ×5
nsstring ×1
uiimage ×1
uiscrollview ×1
uitableview ×1
web-services ×1
xcode ×1
zoom ×1