Monday, 18 February 2013



IOS BASICS EXPLINATIONS BY NAVEENRAJU


Responsive Design By Using "Media Quaries" in IOS

->Responsive web Design is possible by using css3 Media Quaries->We can have 1 style sheet for large diplays and diff styles specify for mobiles based on resulution,pixelsizes->it will allow diff resolutions with out changing the content






CODE FOR MediaQuaryDemos:




MediaQuaryDemo.html

<!Doctype Html><head>
<link rel="stylesheet" type="text/css" href="Media.css" />



</head><body>

<div id="naveen"><img src="grails.jpg"></div>



<div id="left">
Android Blog
</div>




<div id="right">IOs Blog
</div>
</body></html>


Media.css


#container{
width: :600px;margin-right: automargin-left:auto;}
#left {
width:70%;height: 200px;float:left;background:red;}


#right{
width:30%;height: 200px;float:right;background:cyan;}
img{width: 30%;}





@media screen and (max-width: 590px) {



#container{
width: :600px;margin-right: automargin-left:auto;}
#left {
width:70%;height: 200px;float:left;background:orange;}


#right{
width:30%;height: 200px;float:right;background:blue;}
img{width: 30%;}
}

  

ViewController.h

////  ViewController.h//  MediaQuary////  Created by apple on 18/02/13.//  Copyright (c) 2013 apple. All rights reserved.//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController{
                IBOutlet UIWebView *webview;        IBOutlet UIWebView *web;}

@property(nonatomic,retain) UIWebView *webview;@property (strong, nonatomic) IBOutlet UIWebView *web;
//@property(nonatomic,retain) UIWebView *webview1
@end

ViewController.m

////  ViewController.m//  MediaQuary////  Created by apple on 18/02/13.//  Copyright (c) 2013 apple. All rights reserved.//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController@synthesize webview;- (void)viewDidLoad{    [super viewDidLoad];// Do any additional setup after loading the view, typically from a nib.                NSString *path=[[NSBundle mainBundle]pathForResource:@"MediaQuaryDemo" ofType:@"html"inDirectory:@""];    NSURL *url=[NSURL fileURLWithPath:path];    NSURLRequest *request=[NSURLRequest requestWithURL:url];    [webview loadRequest:request];
                    }
- (void)didReceiveMemoryWarning{    [super didReceiveMemoryWarning];    // Dispose of any resources that can be recreated.}
@end

ViewController.xib


No comments:

Post a Comment