I have a tab-bar controller that loads a RootView.
The RootView has 4 buttons that will load a UITableView
I don't want my tab-bar to be visible in the RootView so I added the following code:
-(void)viewDidLoad{
self.hidesBottomBarWhenPushed = YES;
}
When I initially load the app the tab-bar doesn't appear, but when I click on a button, and go back to the RootView the tab-bar still appears. I have tried placing this code in viewWillAppear and other application lifecycle methods but no luck.
Note: Using Monotouch. I have a directory called Images where I have all my PNG files. In my code I have the following
_imgMinusDark = UIImage.FromFile("images/MinusDark.png");
On the simulator it runs fine, on the phone it's null. I have the Images folder content (all the PNGs) in my MonoDevelop marked as Content in terms of Build Action.
What am I missing?
thanks
Hi i am developing an app for my QA department. I need to programically get how many phone numbers are there in the entire address book. No user input. Just click a button and then get how many phonenumbers are there in the ENTIRE addressbook.
Please email me at [email protected]
I have a 'Contact' class with two properties : firstName and lastName.
When I want to display a contact's full name, here is what I do:
NSString *fullName = [NSString stringWithFormat:@"%@ %@", contact.firstName, contact.lastName];
But when the firstName and/or lastName is set to nil, I get a "(null)" in the fullName string. To prevent it, here's what I do:
NSString *first = contact.firstName;
if(first == nil) first = @"";
NSString *last = contact.lastName;
if(last == nil) last = @"";
NSString *fullName = [NSString stringWithFormat:@"%@ %@", first, last];
Does someone know a better/more concise way to do this?
Hey.
I am trying to find an item in a NSMutableArray from it's value, only to find its indexPath.
I have absolutely no idea of how to do this, as I am very new to programming in general.
Thanks!
Hey.
I am trying to make an integer match another integer by adding a number to one of them. I have tried several loop types, but none has worked.
Take a look at the code:
int favoriteLoop = [favoriteThing intValue];
if (favoriteLoop != [[[array objectAtIndex:favoriteLoop] description] intValue]){
NSLog(@"%d", [[[array objectAtIndex:favoriteLoop] description] intValue]);
int favTemp = favoriteLoop;
for (int x = favTemp; (favoriteLoop == [[[array objectAtIndex:favoriteLoop] description] intValue]); x++) {
NSLog(@"Still not there..");
}
}
Could anyone help me clear up this mess? It just won't work!
Could it have something to do with it allready being inside a for-loop?
How to group methods belong to one entity in one class file in Core Data like Linq? In Linq, we can put all methods in the domain object class and reuse them, in Core Data, is there any way to create different classes for different entities? Or we can only use predicate to retrieve?
In my app I create 2 folders for images "Standard" and "Retina" where I put a lot of images for my app. When I open one of my xib file, Interface Builder hang up...
I found that if I remove Retina Image that is used by this xib, then IB will open xib without any problem... This problem occurs only with 1 xib file, another xib files can be opened without any problems. What can be the reason of hang up? Can image be bad? Or maybe I shouldn't put Retina Images to "Retina" folder? What can be the reason?
Thanks...
Why doing assigning nil to nsmutabledictioanry and allocating is crashing ans showing memory release at this point of place??
self.delegate.replenishAddedmaterials = nil;
self.delegate.replenishAddedmaterials = [[NSMutableDictionary alloc] init];
MATERIAL_ITEM *materialItem = [[MATERIAL_ITEM alloc] init];
VENDOR_HEADER *vendor = [[VENDOR_HEADER alloc] init];
PURCHASING_ORG_HEADER *purOrg = [[PURCHASING_ORG_HEADER alloc] init];
[self.delegate.replenishAddedmaterials setObject:[NSMutableArray arrayWithObject:materialItem] forKey:materialItem];
[[self.delegate.replenishAddedmaterials objectForKey:materialItem] addObject:vendor];
[[self.delegate.replenishAddedmaterials objectForKey:materialItem] addObject:purOrg];
After executing allocation of nsmutabledictionary i am getting following message
* -[MATERIAL_ITEM release]: message sent to deallocated instance 0x11e62810I have implemented my project in ARC
Hi..
I am having a table view with default UITableViewCell of style UITableViewCellStyleValue2. I just want to move detailTextLabel few pixels to the right. I know it makes no sense to adjust its width and height :). I am trying to set detailTextLabel's frame with my x and y value. But its not affecting the its frame. I prefer to use default UITableViewCell, in this case, over a customized cell because the default UITableViewCell automatically manages the text alignment and centering of the labels..
How to change UITableViewCell detailTextLabel's frame?
Am I allowed to change its frame?
Thanks everyone..
I want to create two UIViews in quartz 2D application.
First UIView for static text, it will redraw automatically after each one second.
Second UIView for animated text, it will be redrawn automatically after each .1 second.
How can i create multiple Views/Layers? Is there drawRect methods will be different?
UISomeController *controller = [[UISomeController alloc] initWithNibName:@"UISomeController" bundle:nil];
[self.navigationController pushViewController:controller animated:YES];
Is it possible to initialize some variables in the controller at the creation time? And how to do that?
Hi
I want to replace my UIBarButtonItem (used for refresh) with a UIAlertView and, when the refresh is finished, I want to turn back to the refresh button and remove the UIAlertView. Can anyone help me?
Thanks
I am trying to authenticate using the below code
NSString *urlAsString =[NSString stringWithFormat:@"http://www.myurl.com/abc/authenticate.php"];
NSURL *url = [NSURL URLWithString:urlAsString];
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:url];
[urlRequest setTimeoutInterval:30.0f];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest addValue:@"test" forHTTPHeaderField:@"m_username" ];
[urlRequest addValue:@"123" forHTTPHeaderField:@"m_password" ];
[[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
[NSURLConnection sendAsynchronousRequest:urlRequest queue:queue completionHandler:^(NSURLResponse *response,NSData *data, NSError *error) {
if ([data length] >0 && error == nil){
html = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"HTML = %@", html);
receivedData = [NSMutableData data];
}
else if ([data length] == 0 && error == nil){
NSLog(@"Nothing was downloaded.");
}
else if (error != nil){
NSLog(@"Error happened = %@", error);
}
}];
// Start loading data
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];
if (theConnection)
{
// Create the NSMutableData to hold the received data
receivedData = [NSMutableData data];
}
else {
// Inform the user the connection failed.
}
My username password is correct, I think I am not making the proper call thats why I dont get the desired results and the web service is receiving the null parameters.
What can be the issue?
Any help appreciated.
I have a problem with my UIScrollView. It's visible but I can't scroll it.
CGRect frame = CGRectMake(20, 90,280,1000);
scroll1=[[UIScrollView alloc]initWithFrame:frame];
scroll1.contentSize = CGSizeMake(280,1000);
scroll1.backgroundColor=[UIColor grayColor];
//scroll1.delegate=scroll1;
[scroll1 setUserInteractionEnabled:TRUE];
[scroll1 setPagingEnabled:TRUE];
[scroll1 setScrollEnabled:TRUE];
[scroll1 showsVerticalScrollIndicator];
Thanks in advance.
I am using facebook sdk 3.1 framework for my application. The login process works successfully and returns to the app after facebook login both in simulator(iOS 6.0 and 5.0) and in iPad(iOS 6).
But When the same is deployed in IPad with IOS 5, after login, it does not return back to my application and shows a blank white Screen or sometimes my application closes.
I dont know what went wrong in iOS 5 and facebook sdk 3.1 framework, also i am not getting any logs to debug... Please help
Iam using this code for login
NSArray *permissions = [[NSArray alloc] initWithObjects:
//@"user_likes",
//@"read_stream",
@"publish_stream",
@"user_events",
@"read_friendlists",
@"user_birthday",
@"email",
nil];
[FBSession openActiveSessionWithPermissions:permissions allowLoginUI:YES
completionHandler:
^(FBSession *session,
FBSessionState state, NSError *error) {
NSLog(@"state %d", state);
[self sessionStateChanged:session state:state error:error];
}];
Hey everybody!
I wanna have a UILabel that shows the distance between two annotations... but how do I get it to update the distance each time the current location is updated (location)??
CLLocationCoordinate2 savedPlace = savedPosition;
CLLocationCoordinate2D currentPlace = location;
CLLocation *locCurrent = [[CLLocation alloc] initWithLatitude:currentPlace.latitude longitude:currentPlace.longitude];
CLLocation *locSaved = [[CLLocation alloc] initWithLatitude:savedPlace.latitude longitude:savedPlace.longitude];
CLLocationDistance distance = [locSaved distanceFromLocation:locCurrent];
[showDistance setText:[NSString stringWithFormat:@"%g", distance]];
Thanks in advance!
I have created View A and View B. My window has View A displayed on the screen. I also have a UIButton on View A. I want to switch from View A to View B when I click on the Button. I am not using any UIViewController. Is it possible to switch the views without using controller?
I am calling buttonAction method on TOUCHUPINSIDE
The problem is that it doesn't do anything when I say
[ViewA removeFromSuperView];
What should I do now?
I found some sample code from here.
static UIImage *backgroundImageDepressed;
/**
*
*/
@implementation DecimalPointButton
+ (void) initialize {
backgroundImageDepressed = [[UIImage imageNamed:@"decimalKeyDownBackground.png"] retain];
}
is it something like this - +(void) initialize method initialize static variables of a class ( interface ) in objective c ? I have never seen this before.
Please need your guidance on it.
Thanks in advance for sharing your great knowledge.
Sagar
Hello!
I get stuck in some problem and after 2 days of seeking I've found solution but didn't get idea why does it work.
First, I'm initialized NSFetchedResultsController using following code (it look like a lot of automatically generated):
- (NSFetchedResultsController *)fetchedResultsController {
if (fetchedResultsController != nil)
return fetchedResultsController;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Profile"
inManagedObjectContext:self.managedObjectContext];
[fetchRequest setEntity:entity];
[fetchRequest setFetchBatchSize:20];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"lastName" ascending:YES];
NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil];
[fetchRequest setSortDescriptors:sortDescriptors];
NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc]
initWithFetchRequest:fetchRequest
managedObjectContext:self.managedObjectContext
sectionNameKeyPath:nil
cacheName:@"Root"];
aFetchedResultsController.delegate = self;
self.fetchedResultsController = aFetchedResultsController;
NSError *error = nil;
//[aFetchedResultsController performFetch:&error];
[aFetchedResultsController release];
[fetchRequest release];
[sortDescriptor release];
[sortDescriptors release];
return fetchedResultsController;
}
Have a look at commented string - there wasn't any of these strings and when I asked for data - I didn't get any (and it was there!). When I've uncommented that line, it starts work. Seems evident, but all examples I saw before hadn't that line. And they work. How can it be? I just want to know what am I doing wrong.