我有一个UIButton的浮板,位于UIScrollView中,每个UIButton从URL中摄取图像。 如何最容易地把图像装上同步?
例如,通常的做法是:
[button setImage:[UIImage imageWithData:data] forState:UIControlStateNormal];
但这并不是万能的。
我有一个UIButton的浮板,位于UIScrollView中,每个UIButton从URL中摄取图像。 如何最容易地把图像装上同步?
例如,通常的做法是:
[button setImage:[UIImage imageWithData:data] forState:UIControlStateNormal];
但这并不是万能的。
你可以尝试这样做。
[self performSelectorInBackground:@selector(loadImag) withObject:nil];
In loadImage function load the image from url and then assign it to the button. I am not sure this will work for you...As I am a beginner in objective C development
与国家职业安全局合作,对每个图像区提出同步要求。 穿过 but子作为直径,例如这意味着......
• 在行动地点(可能位于内地):
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
1. 启动每个纽州的工作......
NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self
selector:@selector(getImageFromURL:)
object:[NSDictionary dictionaryWithObjectsAndKeys:@"http://getMyImage.com/resource.jpg", @"url", button, @"button", nil]];
[queue addOperation:operation];
[operation release];
∗∗∗∗ 甄选者
- (void) getImageFromURL:(NSDictionary*)dict
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSURL *url = [NSURL URLFromString:[dict objectForKey:@"url"]];
UIButton *button = [dict objectForKey:@"button"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:&error];
UIImage *image = [[UIImage alloc] initWithData:data];
// Finally set the button image and release image ...
[pool drain];
}
Don tabe release queue on dealloc.
希望:
我猜测,如果你在装上单一图像时加以阻挡,那是 al吗? 问题是,你们有许多? 如果是的话,那么我会这样做(不需要的线索):
#define DELAY 0.1 // you may set it to 0 as well
...
[self performSelector:@selector(setupButton:)
withObject:[NSNumber numberWithInt:0]
afterDelay:DELAY];
...
-(void)setupButton:(NSNumber*)count
{
UIButton *button = [self buttonFromMyScrollViewWithCount:count.intValue];
[button setImage:...];
if (count.intValue < self.numberOfButtonsInMyScrollView)
[self performSelector:@selector(setupButton:)
withObject:[NSNumber numberWithInt:count.intValue + 1]
afterDelay:DELAY];
}
I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...
HI, In our application i am using corelocationframework when opening application a alert for allow and dont allow.when clicking on the allow for current location we will show current location.When ...
Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...
我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......
我希望我与四舍五入的累进角进行网上讨论。
我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。
We have a restaurant table that has lat-long data for each row. We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc. We have ...
I like to write bash shell scripts on my iPhone, put them in an app folder with an icon, plist, etc., so they execute like apps by tapping their icon on SpringBoard. This is not interactive like ...