UIViewContentModeScaleAspectFit和UIViewContentModeScaleToFill有什么区别......?
我正在做一个简单的android应用程序.我正在使用以下代码从数组中删除一个元素.
arr_fav = {"1","2","3"};
for(int i= 0;i<arr_fav.length;i++)
{
if(current_id == Integer.parseInt(arr_fav[i]))
{
arr_fav[1] = null;
} }
Run Code Online (Sandbox Code Playgroud)
通过这样做我得到像arr_fav = {"1",null,"3"}的数组.但我想要像arr_fav = {"1","3"}.如何删除元素.这个Android开发的新手请帮我解决这个问题.
我正在对Aadhar卡进行条形码或QR码扫描.我得到的响应为以下xml格式.如何使用xml解析将其转换为字典格式?
<?xml version="1.0" encoding="UTF-8"?><PrintLetterBarcodeData uid="685860050795" name="Sangeetha D" gender="F" yob="1989" co="W/O: Dhanansekaran" house="632" street="saradhambal nagar" lm="agaramel" vtc="Nazarathpettai" po="Nazarethpettai" dist="Tiruvallur" subdist="Poonamallee" state="Tamil Nadu" pc="600123" dob="03/06/1989"/>
Run Code Online (Sandbox Code Playgroud)
我尝试了以下代码进行解析
public func parser(parser: NSXMLParser, didStartElement elementName: String, namespaceURI: String?, qualifiedName qName: String?, attributes attributeDict: [String : String]) {
currentElement=elementName;
print(currentElement)
}
public func parser(parser: NSXMLParser, didEndElement elementName: String, namespaceURI: String?, qualifiedName qName: String?) {
currentElement="";
}
public func parser(parser: NSXMLParser, foundCharacters string: String) {
}
Run Code Online (Sandbox Code Playgroud)
但它总是返回currentElement"PrintLetterBarcodeData"
我如何知道itunesconnect中的我的iphone应用程序下载数量?
我有大小为1200x1200的图像.(从服务器获取).我可以将它减少到800x800(不使用"预览").由于图像大小,我的应用程序崩溃..请帮我解决这个问题. ..提前致谢.
滚动时出现以下错误UITableview.
EXC_BAD_ACCESS,- [CFString retain]:发送给deallocated实例的消息
我怎样才能找到解除分配的实例...?这是我的noOfRowsinsection代码
for(int i=0;i<size;i++)
{
NSString *CellIdentifier1;
if(universalApp==2)
{
NSAutoreleasePool *pool=[[NSAutoreleasePool alloc]init];
CellIdentifier1 = @"CustomThumbImageTableCell_iphone";
cell = [[[CustomThumbImageTableCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier1] autorelease];
//NSLog(@">>>>> Creating image >>>>>>>>");
//cell.thumbImageView = [[CustomImageView alloc] initWithFrame:CGRectMake(4, 4, 83, 101)];
cell.thumbImageView = [[[CustomImageView alloc] initWithFrame:CGRectMake(4, 4, 83, 101)] autorelease];
[imgViewArray addObject:cell.thumbImageView];
[cell.thumbImageView release];
[pool release];
}
Run Code Online (Sandbox Code Playgroud)
这是我的cellforRow代码
enter code hereif(universalApp==2)
{
NSLog(@"iphone cell>>>>>>>>>>>>>>>>>>>>>>");
CustomThumbImageTableCell *cell = nil;
@try
{
static NSString *CellIdentifier = @"CustomThumbImageTableCell_iphone";
int currentRow = [indexPath row] …Run Code Online (Sandbox Code Playgroud) 我是Android的新手.我通过在main.xml中进行以下更改,在我的Android应用程序中添加了AdMob:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<com.google.ads.AdView
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent"
ads:adSize="BANNER"
ads:adUnitId="XXXXXXXXX"
ads:loadAdOnCreate="true" />
</LinearLayout>
</TabHost>
Run Code Online (Sandbox Code Playgroud)
我的项目成功运行,没有错误,但我没有收到广告.
WARN/Ads(3805): Not enough space to show ad! Wants: <320, 50>, Has: <320, 0>.
Run Code Online (Sandbox Code Playgroud) 我使用以下代码在mapview中添加了MKAnnotation.
Flag *flag = [[Flag alloc] init];
flag.title = @"Golf Course";
flag.subtitle = @"Green";
flag.coordinate =CLLocationCoordinate2DMake(28.457394,77.108667);
[mapView addAnnotation:flag];
Run Code Online (Sandbox Code Playgroud)
并设置图像
-(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:
(id <MKAnnotation>)annotation
{
if(([annotation isKindOfClass:[Flag class]]))
{
MKPinAnnotationView *pinView = nil;
if(annotation != mapView.userLocation)
{
static NSString *defaultPinID = @"PinId1";
pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if ( pinView == nil ) pinView = [[[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:@"pin1"] autorelease];
//pinView= [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"pin1"];
pinView.canShowCallout = YES;
pinView.draggable = YES;
[pinView setImage:[UIImage imageNamed:@"flag2.png"]];
}
else
{
[mapView.userLocation setTitle:@"I …Run Code Online (Sandbox Code Playgroud) 我想为我的项目创建一个可重用的UIAlertController类.我尝试了以下代码.但我的警报没有显示.我的代码或任何代码帮助有什么问题.这是我的警报类
class AlertView: NSObject {
class func showAlert(view: UIViewController , message: String){
let alert = UIAlertController(title: "Warning", message: message, preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
view.presentViewController(alert, animated: true, completion: nil)
}
}
Run Code Online (Sandbox Code Playgroud)
我在另一个视图控制器中调用它
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
AlertView.showAlert(self, message: "Test alert")
// Do any additional setup after loading the view, typically from a nib.
}
}
Run Code Online (Sandbox Code Playgroud) 我正在UITableViewCell使用以下功能加载图像.但是当我用Debugger运行我的应用程序时,[pool release]每当我滚动我的时候它就会崩溃UITableView.我该怎么做才能解决这个问题?提前致谢.
- (void) loadImage{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
imageURL = [imageURL stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
//NSLog(@"img url cell**** %@",imageURL);
self.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imageURL]]];
//self.image = [NSData dataWithContentsOfURL:[NSURL URLWithString:imageURL]];
[pool release];
}
Run Code Online (Sandbox Code Playgroud) 如何在swift中使用'guard'.我已经阅读了很多关于'guard'的文章.但是我没有清楚地了解这个.请给我一个明确的想法.请给我一些关于'if'语句的示例输出.
if firstName != ""
{
if lastName != ""
{
if address != ""
{
// do great code
}
}
}
Run Code Online (Sandbox Code Playgroud) 我声明了字符串数组,string pdts[10];但是我收到了声明语法错误.我已经收到了相同的错误.请帮我解决.我的代码是
#include<iostream.h>
#include<string.h>
string pdts[10];
Run Code Online (Sandbox Code Playgroud) iphone ×7
ios ×3
swift ×3
android ×2
app-store ×2
arrays ×2
string ×2
admob ×1
c++ ×1
contentmode ×1
if-statement ×1
ipad ×1
java ×1
mkannotation ×1
mkmapview ×1
nsxmlparser ×1
objective-c ×1
swift2 ×1
uiimageview ×1
xml ×1
xml-parsing ×1