Sunday, 19 January 2014

Windows Software,Games and Cracks

Wednesday, 8 January 2014

AlertView Text Field


UIAlertView *av = [[UIAlertView alloc]initWithTitle:@"Subscribe to Newsletter" message:@"Please Enter Your Email id:" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Submit", nil];
        av.alertViewStyle = UIAlertViewStylePlainTextInput;
        [av textFieldAtIndex:0].delegate = self;
        [av show];


- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex{
    
    // The first button (or cancel button)
    if (buttonIndex == 0) {
    }
    
    // The second button on the alert view
    if (buttonIndex == 1) {
        NSLog(@"Alert-%@",[av textFieldAtIndex:0].text);
}
}

Email Verification in IOS


 NSString *emailRegEx = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
        NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegEx];

if ([emailTest evaluateWithObject:emailField.text] == NO)
        {
            UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Invalid Email Id!" message:@"Please try again" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil,nil];
            [alert show];
        }else{
            
            UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Almost Finished." message:@"To complete the subscription process, please click the link we sent to you to your email." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil,nil];
            [alert show];
        }

Parsing XML like http://steinmann.webs.com/blub.xml

http://steinmann.webs.com/blub.xml



- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];



  
    NSData *xml = [NSData dataWithContentsOfURL: [NSURL URLWithString:@"http://weather.yahooapis.com/forecastrss?w=20070008"]];
    
    
    self->parser=[[NSXMLParser alloc]initWithData:xml];
    [self->parser setDelegate:self];
    [self->parser parse];

NSDictionary *dict = [xmlElementObjects objectAtIndex:0];
    NSLog(@"DObjects-%@",dict);
    titless.text=[dict objectForKey:@"title"];
    
    high.text=[[dict objectForKey:@"description"]stringByAppendingString:@"°F"];

 [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
    [activ stopAnimating];
}

-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
    if ([elementName isEqualToString:@"item"]) {
        [self->xmlElementObjects addObject:attributeDict];
    }
}




Tuesday, 7 January 2014

Free Weather API for IOS

See XML Provided by Yahoo.

http://weather.yahooapis.com/forecastrss?w=4097

change w(woeid) of the location you need.

You could get woeid of your current location by giving the coordinates through the following XML.


http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20text%3D%2237.416275%2C-122.025092%22%20and%20gflags%3D%22R%22



TableView: avoiding repeated data in reuseidentifier

Make "nil" instead of CellIdentifier in


if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
as

if (cell == nil) {
        cell = [[UITableViewCell allocinitWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
    }