Skip to main content

Posts

Showing posts from January, 2013

CorePlot - What is CPTXYPlotSpace?

A plot space using a two-dimensional cartesian coordinate system. The xRange and yRange determine the mapping between data coordinates and the screen coordinates in the plot area. The "end" of a range is the location plus its length. Note that the length of a plot range can be negative, so the end point can have a lesser value than the starting location. The global ranges constrain the values of the xRange and yRange . Whenever the global range is set (non-nil), the corresponding plot range will be adjusted so that it fits in the global range. When a new range is set to the plot range, it will be adjusted as needed to fit in the global range. This is useful for constraining scrolling, for instance. Example codes: CPTXYPlotSpace *plotSpace =(CPTXYPlotSpace *) graph.defaultPlotSpace; plotSpace.xRange =[CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(xMin) length:CPTDecimalFromFloat(xMax)]; plotSpace.yRange =[CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(yMin) l…

How to write text on image in IOS

Draw text inside an image and return the resulting image: +(UIImage*) drawText:(NSString*) text inImage:(UIImage*) image atPoint:(CGPoint) point {UIFont*font =[UIFont boldSystemFontOfSize:12];UIGraphicsBeginImageContext(image.size);[image drawInRect:CGRectMake(0,0,image.size.width,image.size.height)];CGRect rect =CGRectMake(point

IOS: Multiple Lines of UITextField

Apple makes UITextView Default border meanless - no border .

Below sample codes help you to make the border looks like others.

_textViewDetails.layer.cornerRadius = 5;     [_textViewDetails.layersetBorderColor:[[[UIColorgrayColor] colorWithAlphaComponent:0.5] CGColor]];      [_textViewDetails.layersetBorderWidth:2.0]; _textViewDetails.clipsToBounds = YES;

Simple methods for date formatting and transcoding

forwarded from
http://www.cocoawithlove.com/2009/05/simple-methods-for-date-formatting-and.html


There is no single-line method for converting between formatting date strings and date objects in Cocoa — the API opts for flexibility rather than simplicity. Unfortunately, this combines with documentation that omits, misdirects and occasionally misinforms, making NSDateFormatter one of the more confusing classes for new Cocoa programmers. In this post, I'll try to address some of the documentation issues and I'll present some methods that will turn NSDate into a formatted string or convert between date strings in a single method.

Default, locale-based date formatting Before I get into date formatting strings (which is the real purpose of this post) I will quickly show you how to get a string from an NSDate: NSDate*date = [NSDatedate