我正在尝试在单元格中构建带有字幕文本的表格视图
问题是,当我尝试将字幕文本的对齐方式设置为右侧时,它不起作用,但它与主文本一起正常工作
这是我的代码
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CustomCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
[[cell textLabel] setTextAlignment:UITextAlignmentRight];
[[cell detailTextLabel] setTextAlignment:UITextAlignmentRight];
cell.textLabel.text = [array objectAtIndex:indexPath.row];
cell.textLabel.font = [UIFont systemFontOfSize:18];
cell.detailTextLabel.text = @"test";
return cell;
}
Run Code Online (Sandbox Code Playgroud)
当我删除字幕代码时,对齐工作正常
任何的想法 ?
我试图在iOS中解析mapquest地理编码json,但NSJSONSterilization返回null.我检查了在线json检查器,看起来网址实际上是一个json.
这是代码 NSJSONSerialization
if(geocodeResponseData)
{
NSLog(@"there is response data");
//this is logged.
}
NSDictionary *mapQuestReponse = [NSJSONSerialization
JSONObjectWithData:geocodeResponseData
options:kNilOptions
error:&error];
NSLog(@"mapquestreponse %@", mapQuestReponse);
Run Code Online (Sandbox Code Playgroud)
这是JSON为解析而返回的URL.
http://www.mapquestapi.com/geocoding/v1/batch?key=API----KEY----HIDDEN----&callback=renderBatch&outFormat=json&location=14443%20C%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=14510%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=14550%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=14515%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=1480%20S%20De%20Anza%20Blvd,San%20Jose,%20CA%2095129&location=1600%20S%20De%20Anza%20Blvd,San%20Jose,%20CA%2095129&location=18486%20Prospect%20Rd,San%20Jose,%20CA%2095070&location=14572%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=5210%20Prospect%20Rd,San%20Jose,%20CA%2095129&location=1600%20S%20De%20Anza%20Blvd,San%20Jose,%20CA%2095106&location=14480%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=1818%20Saratoga%20Ave,San%20Jose,%20CA%2095129&location=18562%20Prospect%20Rd,Saratoga,%20CA%2095070&location=14560%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=14420%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=1075%20S%20De%20Anza%20Blvd,Cupertino,%20CA%2095129&location=18802%20Cox%20Ave,Saratoga,%20CA%2095070&location=6154%20Bollinger%20Rd,San%20Jose,%20CA%2095129&location=14555%20Big%20Basin%20Way,Saratoga,%20CA%2095070&location=14000%20Fruitvale%20Ave,Saratoga,%20CA%2095070
Run Code Online (Sandbox Code Playgroud)
是因为回来NULL了utf-8吗?提前致谢
我在我的iPhone应用程序中查看了一些动画,感觉它有点难看.然后我继续说道:它只是没有动画通过亚像素状态.
所以,如果我使用通常的+ beginAnimations/+ commitAnimations,移动一些东西只是几个像素看起来"跳跃".我怎么能避免呢?是否有任何标志可以通过浮动坐标或其他任何东西制作动画?
只是为了让您了解我拥有的和我正在寻找的东西,请参考图片:
alt text http://www.ptoing.net/subpixel_aa.gif
在此先感谢,安东
我允许在我的应用程序中共享itunes,但我注意到coredata在文档目录中创建了sqlite
如果是的话,我可以将此文件的保存更改为库吗?
最好的祝福
我花了最近几天才第一次使用Core Plot.我花了一些时间弄清楚它是如何工作的,但我几乎可以实现我所寻找的所有功能.但有一件事我没有找到解决方案:
我正在使用两个轴上带有标签的XY图.plotAreaFrame有一个左边的填充,可以将plotArea向右移动,并为y轴标签创建一些空闲空间.只要标签不大,这样就可以正常工作,例如,对于高达100的值,但是如果y值变大,例如.10.0000,填充不足以显示完整的标签.
当然我可以使用更高的填充但是如果我只有很小的y值,这会浪费空间.
有没有办法根据标签自动调整填充?
这真的很奇怪.我有一个包含三个图像的滚动视图,用户滑动以查看下一个图像.但是,我希望第一个屏幕从中间图像开始.简单; 我将使用setContentOffset,一切都会好的.
该代码适用于iPhone模拟器,但不适用于iPad模拟器(或设备!)
CGRect screen = [[UIScreen mainScreen] bounds];
CGFloat height = CGRectGetHeight(screen);
CGFloat width = CGRectGetWidth(screen);
CGPoint rightOffset = CGPointMake(width, 0);
[scrollView setContentOffset:rightOffset animated:YES];
Run Code Online (Sandbox Code Playgroud)
所有设置都在添加scrollView之前设置(实际上我们可以在添加了相同结果的scrollview之后执行此操作).
宽度在ipad上返回768,在iphone上返回320.
这是一个错误吗?Xcode 4.4.1和ios 6.
编辑:
看起来这与创建顺序有关; 移动到viewWillAppear而不是viewDidLoad,显然是在iphone和ipad上工作.只是不一致是非常令人惊讶的....
我一直在墙上敲打着我的头.我有一个使用Master-Detail SplitViewController作为其演示框架的iPad应用程序.我需要在应用程序首次加载时显示登录对话框,并使其具有自定义大小.我在主故事板中创建了一个UIViewController场景,并在DetailController首次加载时加载VC.
我遇到的问题是我无法控制VC的大小.我将它定义为FormSheet,以纵向模式显示.我将Presentation设置为FormSheet.我尝试以几种不同的方式明确设置大小,但绝对没有任何作用.
根本问题在于,由于所有这一切,VC 总是以全屏形式呈现为肖像.当我旋转到横向时,它将保持纵向模式,在左右两侧留下间隙,并切断视图的顶部和底部.
这令人难以置信的沮丧,我真的不知道从哪里开始.有趣的是,在app完全加载后,我使用tap来呈现完全相同类型的VC.它呈现出精美,使用以下设置:
MyViewController *itemDetails;
itemDetails = [Globals.storyboard instantiateViewControllerWithIdentifier:@"MyViewController"];
itemDetails.itemImage.image = imageView.image;
itemDetails.jewelryObject = jewelryObject;
itemDetails.delegate = self;
itemDetails.modalPresentationStyle = UIModalPresentationPageSheet;
itemDetails.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:itemDetails];
itemDetails.navigationItem.title = jewelryObject.itemDescription;
[navigationController setModalPresentationStyle:UIModalPresentationFormSheet];
[self presentViewController:navigationController animated:YES completion:nil];
navigationController.view.superview.autoresizingMask =
UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleBottomMargin;
navigationController.view.superview.frame = CGRectMake(
itemDetails.view.superview.frame.origin.x,
itemDetails.view.superview.frame.origin.y,
540.0f,
450.0f
);
navigationController.view.superview.center = self.view.center;
self.itemDetails = itemDetails;
Run Code Online (Sandbox Code Playgroud)
我非常沮丧,甚至无法表达.尽管我喜欢iOS编程,但偶尔有一些WTF时刻让我希望自己是一个隐士.如果有人有任何"啊哈!" 他们可以向我倾诉的见解,我真的很感激.
今晚我们遇到了一个恼人的问题,只能在Xcode的命令行构建中出现,而不是来自Xcode的GUI.
当从具有Xcode GUI的机器构建时,使用$ PROJROOT的递归用户头搜索路径,没有双引号,我们没有遇到任何问题.但是,当使用使用Xcode命令行构建功能的Jenkins进行构建时,会抛出Headers不可用的错误.
经过一个小时的探索,有人决定尝试用双引号包装反复的$ PROJROOT("$ PROJROOT").一旦发生这种情况,Jenkins命令行的建设终于成功了.
所以我们并不完全理解用引号包装搜索路径或省略引号的后果.
任何人都可以了解究竟是什么导致了这个问题?什么双引号从命令行对GUI表示编译器?
我希望我的应用程序能够将文件的完整路径复制到剪贴板之前.
我试过这个:
NSPasteboard *p = [NSPasteboard generalPasteboard];
NSDictionary *options = [NSDictionary dictionary];
NSString *path = [[p readObjectsForClasses:[NSArray arrayWithObjects:[NSString class], nil] options:options] objectAtIndex:0];
Run Code Online (Sandbox Code Playgroud)
这只返回文件名,而不是路径.
你能帮助我吗?
我在 .h 文件中有一个 @property opacity
@property (assign) NSNumber *opacity;
Run Code Online (Sandbox Code Playgroud)
然后在 .m 文件中我
@synthesize opacity;
Run Code Online (Sandbox Code Playgroud)
然后在
- (id)initWithFrame:(NSRect)frame
Run Code Online (Sandbox Code Playgroud)
我做了
opacity = [NSNumber numberWithFloat:1.0];
Run Code Online (Sandbox Code Playgroud)
当我运行应用程序时,Xcode 显示此错误
Thread 1: EXC_BAD_ACCESS (code-EXC_I386_GPFLT)
Run Code Online (Sandbox Code Playgroud)
但是,如果我将该行更改为
opacity = [NSNumber numberWithInteger:1];
Run Code Online (Sandbox Code Playgroud)
一切正常。
ios ×5
iphone ×2
objective-c ×2
antialiasing ×1
clipboard ×1
cocoa ×1
cocoa-touch ×1
core-data ×1
core-plot ×1
jenkins ×1
labels ×1
macos ×1
mapquest ×1
nsnumber ×1
nspasteboard ×1
null ×1
padding ×1
parsing ×1
popupwindow ×1
scrollview ×1
search-path ×1
uilabel ×1
uiscrollview ×1
uitableview ×1
xcode ×1