#define IS_RETINA ([[UIScreen mainScreen] respondsToSelector:@selector(displayLinkWithTarget:selector:)] && ([UIScreen mainScreen].scale == 2.0))
if(IS_RETINA)
{
// Retina display
} else {
// non-Retina display
}
Showing posts with label size. Show all posts
Showing posts with label size. Show all posts
Full Screen Dialog
final Dialog instructionDialog = new Dialog(getParent(), android.R.style.Theme);
instructionDialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
instructionDialog.setContentView(getLayoutInflater().inflate(R.layout.dialog_instruction
, null));
instructionDialog.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
Button btn = (Button) instructionDialog.findViewById(R.id.btn_instruction);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
instructionDialog.dismiss();
}
});
instructionDialog.show();
Convert CGPoint, CGRect or CGSize to String
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint previousPoint1 = [touch previousLocationInView:self];
NSLog(@"touch begin %@", NSStringFromCGPoint(previousPoint1));
}
NSStringFromCGRect(CGRect rect)
NSStringFromCGSize(CGSize size)
Resize UIImage
+ (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize {
//UIGraphicsBeginImageContext(newSize);
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
Labels:
change,
image,
iphone SDK,
size
Get screen/application/status bar frame dimensions
CGRect rect;
// Get screen dimensions
rect = [[UIScreen mainScreen] bounds];
NSLog(@"Bounds: %1.0f, %1.0f, %1.0f, %1.0f", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
// Get application frame dimensions (basically screen - status bar)
rect = [[UIScreen mainScreen] applicationFrame];
NSLog(@"App Frame: %1.0f, %1.0f, %1.0f, %1.0f", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
// Get status bar frame dimensions
rect = [[UIApplication sharedApplication] statusBarFrame];
NSLog(@"Statusbar frame: %1.0f, %1.0f, %1.0f, %1.0f", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
Labels:
bounds,
dimention,
iphone SDK,
size
Subscribe to:
Posts (Atom)