Posts

Post not yet marked as solved
4 Replies
1.6k Views
I have an iOS application which is developed years ago and sets backgrounds of many controls using images.xcassets catalog. The images are set using contents.json in which targets are iPhone, iPad using 'idiom' key. Further specifications include 'scale' & 'filename'. Seems that this app worked fine until iOS 8.As of today there are many high screen resolution devices of iPhone, iPad. So, I need to add further more images targeting these high screen resolution devices.I don't know how it is handled earlier, but now there are different screen resolutions in the same scale factor. For e.g., iPad Pro 12.9" & iPad Pro 11" have '2x' as scale factor but has different resolutions '2048x2732' & '1668x2388' respectively. Now if I create an image targeting highest resolution 2048x2732, the image is not getting centered for resolution 1668x2388.Is there any particular key in contents.json that can differentiate screen resolutions/sizes for the same scale factor?When I search for Apple's documentation for asset catalog it is found in this documentation archive. Does that mean we shouldn't use asset catalog for images any more? Are there any latest standards for setting background images?
Posted Last updated
.
Post not yet marked as solved
0 Replies
556 Views
My app has a lengthy graph to be displayed where the X-Axis is marked with years ranging from 400 to 2100. The graph is drawn in a UIView and added as sub view to a UIScrollView. The axis is drawn with year markers using CGContextRef in drawRect (Code pasted below).Due to lengthy axis the width of graph's (UIView) frame is set to 10000. This graph is drawn without issues in medium screen resolution devices like iPad 2. However when this graph is opened in high resolution devices like iPad Air, issues like background not drawn (became transparent) and when scrolled the entire graph becomes messy due to contents redrawn without erasing previously drawn content.Even I have called following methods in 'setFrame' delegate but no use.[self setNeedsLayout]; [self setNeedsUpdateInRect:self.frame];Can anyone suggest drawing graphics in drawRect in efficient way to handle performance for high resolution devices?Following is my code in drawRect delegate:CGContextRef context = UIGraphicsGetCurrentContext(); [self.layer renderInContext:context]; CGPoint startPoint = CGPointMake(graphEndPadding, graphBaselineY); CGContextMoveToPoint(context, startPoint.x, startPoint.y); //Create line from starting point to end point CGPoint endPoint = CGPointMake(graphLengthPixels+graphEndPadding, graphBaselineY); CGContextAddLineToPoint(context, endPoint.x, endPoint.y); //Create hashmark point system CGFloat currX = startPoint.x; CGFloat yVal = startPoint.y + graphHashMarkLength; //Draw hashmarks int count = 0; while(currX <= endPoint.x) { //Draw hashmark CGContextMoveToPoint(context, currX, graphBaselineY); CGContextAddLineToPoint(context, currX, yVal); //Move to next hashmark currX += pixelYearIncrement; count++; } //Draw x-axis CGContextSetLineWidth(context, 1); CGContextSetLineCap(context, cgLineCapSquare); CGContextSetRGBStrokeColor(context, 0.7765, 0.6118, 0.4275, 1.0); CGContextStrokePath(context);
Posted Last updated
.
Post not yet marked as solved
0 Replies
1.1k Views
My application has a 'Search Bar' inside a UIView named as 'Container for Search Bar' which is again placed under a Navigation Bar. On the Interface Builder auto layout constraints are set between the search bar and UIView as shown below:First Item: Search Bar.Top Relation: Equal Second Item: Container for Search Bar.Top Constant: 0 Priority: 1000 Multiplier: 1First Item: Search Bar.Leading Relation: Equal Second Item: Container for SearchBar.Leading Constant: 0 Priority: 1000 Multiplier: 1First Item: Search Bar.Trailing Relation: Equal Second Item: Container for SearchBar.Trailing Constant: 0 Priority: 1000 Multiplier: 1The 'Container for Search Bar' (UIView) is set with width: 480 and Height: 44. Autoresizing for UIView is set to stretch and position relatively in all directions. The search bar is also set with width: 480.The UIView container is placed between back/forward buttons inside navigation bar. That's the reason the UIView container is set with 'Auto-Resizing' instead of setting auto layout constraints. As it is between two button items I think it can't be set with leading & trailing space constraints to its parentUntil IOS 10 the UIView and Search Bar stretched relatively based on the screen resolution of the device. However for IOS 12.1 version 'Search bar' becomes invisible at runtime. When I have debugged and checked the sizes, widths of both UIView and its child 'Search Bar' are set to 0 at runtime. When auto-layout constraints are removed then only the search bar is visible but not stretching according to screen resolution.Need help in solving this problem.
Posted Last updated
.