我目前正在iOS 5.1中构建一个使用ARC的导航控制器应用程序.我经常需要显示网页,我创建了一个Web查看器,它只是一个UIWebView,旁边有一些自定义内容.当用户完成查看页面时,他们点击后退按钮,后退按钮应释放与自定义Web查看器关联的所有内存.我的问题是,当按下后退按钮时,所有内存似乎都没有被释放.我已经构建了一个玩具应用程序(在github上),它只是几个按钮,每个按钮都有一个调用不同页面的第一响应者.
@implementation ViewController
-(IBAction)googlePressed:(id)sender
{
CustomWebView *customWebView = [[CustomWebView alloc] initWithStringURL:@"http://www.google.com"];
[self.navigationController pushViewController:customWebView animated:NO];
}
-(IBAction)ksbwPressed:(id)sender
{
CustomWebView *customWebView = [[CustomWebView alloc] initWithStringURL:@"http://www.ksbw.com/news/money/Yahoo-laying-off-2-000-workers-in-latest-purge/-/1850/10207484/-/oeyufvz/-/index.html"];
[self.navigationController pushViewController:customWebView animated:NO];
}
-(IBAction)feedProxyPressed:(id)sender
{
CustomWebView *customWebView = [[CustomWebView alloc] initWithStringURL:@"http://feedproxy.google.com/~r/spaceheadlines/~3/kbL0jv9rbsg/15159-dallas-tornadoes-satellite-image.html"];
[self.navigationController pushViewController:customWebView animated:NO];
}
-(IBAction)cnnPressed:(id)sender
{
CustomWebView *customWebView = [[CustomWebView alloc] initWithStringURL:@"http://www.cnn.com/2012/04/04/us/california-shooting/index.html?eref=rss_mostpopular"];
[self.navigationController pushViewController:customWebView animated:NO];
}
Run Code Online (Sandbox Code Playgroud)
CustomWebView只是在IB到UIWebView属性中链接的UIWebView
@implementation CustomWebView
@synthesize webView, link;
- (id)initWithStringURL:(NSString *) stringURL
{
if (self = [super init]) {
link = stringURL;
}
return self;
}
- (void)viewDidLoad …Run Code Online (Sandbox Code Playgroud) 我有一个带有MKMapView的应用程序和每次地图更改位置时调用的代码(在regionDidChangeAnimated中).应用程序最初加载时,将在显式更新地图坐标的平移(滑动),捏合,点击和按钮上调用regionDidChangeAnimated.加载其他视图并返回到地图后,仅调用tapDidChangeAnimated和显式更新地图的按钮.平移地图并捏不再调用regionDidChangeAnimated.
我看过这个没有解决这个问题的stackoverflow帖子.关于devforums和iphonedevsdk的论坛帖子也没有用.有谁知道这个问题的原因是什么?我没有向MKMapView添加任何子视图.
如果返回多个值,如何引用游标的特定值?
DECLARE
X INTEGER;
CURSOR c1 IS SELECT col1, col2, col3.....;
BEGIN
OPEN c1;
LOOP
EXIT WHEN c1%NOTFOUND;
FETCH (col2 from c1) INTO X;
END LOOP;
END;
Run Code Online (Sandbox Code Playgroud) 我有一个表,称之为t1,有三个整数列c1,c2,c3.c1的默认值为:
not null default nextval
Run Code Online (Sandbox Code Playgroud)
对于我目前正在进行的INSERT语句,我希望c2具有与将分配给c1相同的值.对于我的大多数插入都不是这种情况,因此将c2定义为具有默认值或在更新时具有触发器没有意义.目前我正在做两个陈述:
INSERT INTO t1 (c3) VALUES (val3);
UPDATE t1 SET c2 = c1 WHERE //Get correct row
Run Code Online (Sandbox Code Playgroud) 我希望能够通过允许用户在UIAlertView中键入地址或位置来更新MKMapView上显示的区域.我目前有:
if (geocoder.geocoding)
[geocoder cancelGeocode];
[geocoder geocodeAddressString:[[alertView textFieldAtIndex:0] text] completionHandler:^(NSArray *placemarks, NSError *error) {
if (!error) {
NSLog(@"Found a location");
} else {
NSLog(@"Error in geocoding");
}
NSLog(@"Num found: %d", [placemarks count]);
CLPlacemark *placemark = [placemarks objectAtIndex:0];
MKCoordinateRegion region;
region.center.latitude = placemark.region.center.latitude;
region.center.longitude = placemark.region.center.longitude;
MKCoordinateSpan span;
double radius = placemark.region.radius / 1000;
NSLog(@"Radius is %f", radius);
span.latitudeDelta = radius / 112.0;
//span.longitudeDelta = ???
region.span = span;
NSLog(@"Region is %f %f %f", region.center.latitude, region.center.longitude, span.latitudeDelta);
[mapView setRegion:region animated:YES];
}]; …Run Code Online (Sandbox Code Playgroud) 我目前在NSOperation中有以下代码,它有一个keyPath"isCancelled"的观察者:
downloaded = FALSE;
NSURL *url = [NSURL URLWithString:requestString];
dataXML = [[NSData alloc] initWithContentsOfURL:url];
downloaded = TRUE;
Run Code Online (Sandbox Code Playgroud)
我想这样做,以便observeValueForKeyPath函数能够取消dataXML继续或只是在NSOperation发送取消消息后完全停止NSOperation.NSOperation的取消操作取消仅通知操作它应该停止,但不会强制我的操作代码停止.
ios ×4
mkmapview ×2
clgeocoder ×1
cllocation ×1
cursor ×1
database ×1
ios5 ×1
iphone ×1
memory ×1
nsdata ×1
nsoperation ×1
oracle ×1
pan ×1
postgresql ×1
sql ×1
swipe ×1
tap ×1
uiwebview ×1