Tag: ipad

App running slowly because of UIImageViews

I have three large UIImageViews displaying images within my iPad app (each is almost the size of the screen, and they have special effects such as rotation, shadows, etc to look like a news stack). When these images are displayed, the app runs VERY SLOWLY. UIAlertViews literally look like they have only two frames when […]

Loading custom UIView in UIViewController's main view

I have subclassed UIView and created a NIB that controls the main logic for my application. Hoping the view will scale nicely, I want to use it for both the iPhone and iPad versions of the app. On the iPhone the view will cover the full screen. On the iPad the view will cover only […]

Find if user prefers 12 / 24 Hour Clock?

I’ve got a drawRect that makes a timeline a bit like iCal. I use a for loop to write the times along a scroll view. I was wondering if A) theres a way of determining whether the user has chosen a 12 or 24 hour clock in the system settings and B) if there is […]

Multithreading and Grand Central Dispatch on iOS

now i am trying to understand the concept of gcd. using grand central dispatch how to implement multithreading in my application.i have the idea about the gcd concept but i cant implement the concept to my application.i need a simple example with blocks to understand the multithreading using gcd.please help me…

find the location {x,y} of text in uilabel

I have a string coming from server which I am displaying on UILabel multiligne. It is within that string, I am identifying some particular substring. I want to place a button on that substring(button will be a subview of UILabel). For this I require substring coordinates. I went through this but I am not able […]

remove UIView subview based on tag?

I am creating a view like this: UILabel *qty = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 20)]; qty.backgroundColor = [UIColor whiteColor]; qty.text =[NSString stringWithFormat:@” Qty: %@”, currentQty]; qty.alpha = 0.5; [qty setTag:999]; [self.view addSubview:qty]; [qty release]; This can happen multiple times in this view controller so before I create a new view like this I want […]

How to name a block of code and call it in a different method?

I use Grand Central Dispatch methods to do some executions of my app in a queue. I decide the frames for buttons in a calculation on that queue. I want my app to re-draw its scren and calculate new frames after rotation. Here is some pseudo code explanation from what i do: CGFloat a=123, b=24; […]

What is the best way to stop a chain of block based animations

Assuming a chain of block based animations like the following: UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; //animation 1 [UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{ view.frame = CGRectMake(0, 100, 200, 200); } completion:^(BOOL finished){ //animation 2 [UIView animateWithDuration:2 delay:0 options: UIViewAnimationOptionRepeat |UIViewAnimationOptionAutoreverse animations:^{ [UIView setAnimationRepeatCount:1.5]; view.frame = CGRectMake(50, 100, 200, 200); } completion:^(BOOL […]

NSCachesDirectory not a directory in my file system

I’m trying to store something in my Caches folder on my iPad app. NSArray* cachePathArray = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); NSString* cachePath = [cachePathArray lastObject]; And when I print out the returned filepath, I get: /Users/Gela/Library/Application Support/iPhone Simulator/5.0/Applications/3FF7EB1A-49A9-4B13-ADC4-DF0662BA724B/Library/Caches However, when I navigate to that folder on my hard drive, “Caches” is not a folder but a […]

float:left in objective-c

I’m trying to make a bunch of buttons behave somewhat like float:left in CSS. So whenever the view changes size, on orientation change for example, the buttons should adjust so they fit within their container view. In landscape mode, this UIScrollView should scroll horizontally, in portrait mode, it should scroll vertically. I’m trying to make […]