我在Xcode 6.1中显示谷歌地图时遇到了一些问题
我设法让地图显示在我的UIView的一部分中,但是它显示的是世界地图而不是特定的坐标.
这是问题:

.H:
@interface MapViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIView *googleMapView;
- (IBAction)mapToMain:(UIButton *)sender;
@end
Run Code Online (Sandbox Code Playgroud)
.M:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude: 32.915134
longitude: -117.140269 zoom: 17];
GMSMapView *mapView = [GMSMapView mapWithFrame:self.googleMapView.bounds
camera:camera];
mapView.myLocationEnabled = YES;
self.googleMapView = mapView;
GMSMarker *marker = [ [GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(32.915134, -117.140269);
marker.title = @"Tet Festival 2015";
marker.snippet = @"VAYA Tet";
marker.map = mapView;
} …Run Code Online (Sandbox Code Playgroud) 我有一个多线UILabel,如下所示:
我使用以下代码实现了这一点:
label.lineBreakMode = .ByWordWrapping
label.numberOfLines = 2
Run Code Online (Sandbox Code Playgroud)
我试图"减少"第一行和第二行之间的行间距,我尝试使用以下代码:
let text = label.attributedText
let mas = NSMutableAttributedString(attributedString:text!)
mas.replaceCharactersInRange(NSMakeRange(0, mas.string.utf16.count),
withString: label.text!)
label.attributedText = mas
Run Code Online (Sandbox Code Playgroud)
但是,它似乎不起作用.
谢谢
我UICollectionView只用了一个部分。这里是一些可视化:
[ x x x ]
[ x x x ]
[ x x ]
Run Code Online (Sandbox Code Playgroud)
如果的最后一行UICollectionView没有填满所有3个单元格,我想像这样将这些单元格居中:
[ x x x ]
[ x x x ]
[ x x ]
Run Code Online (Sandbox Code Playgroud)
我尝试从以下位置实施解决方案:
但是,解决方案会移动所有单元格,并且如果最后一行不包含X个单元格,则我只想移动LAST行,因为我只有一个部分。
我知道如何设置插图,但是我不知道如何仅靠一个部分并尝试调整单元格的最后一行的插图来实现这一点。
我刚刚开始使用UICollectionView,不确定如何解决此问题?
我的问题是在迭代时如何在下一个索引处开始一个列表?
for elem1, elem2 in zip(unigram_mixture_list, bigram_mixture_list):
print elem1, elem2
Run Code Online (Sandbox Code Playgroud)
我想开始遍历elem1前面的一个索引。
我将如何在 python 中实现这一目标?
我试图理解为什么本地通知没有显示在前台.我相信我添加了所有正确的代码以允许此功能,但当我的应用程序在前台时没有显示横幅.
这是我添加的内容AppDelegate.swift:
import UserNotifications
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate
{
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
{
UNUserNotificationCenter.current().requestAuthorization(options: [UNAuthorizationOptions.alert, UNAuthorizationOptions.sound, UNAuthorizationOptions.badge]) { (willAllow: Bool, error: Error?) in
if willAllow == true
{
// Do something
}
}
UNUserNotificationCenter.current().delegate = self
// Override point for customization after application launch.
return true
}
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)
{
print("GO IN HERE")
completionHandler(.alert)
}
func userNotificationCenter(_ center: …Run Code Online (Sandbox Code Playgroud) 我试图通过尝试触发每日通知来测试iOS 10中的本地通知.
我正在使用以下示例项目: NotificationsUI-Demo
在应用程序中是以下代码之一:
let calendar = Calendar(identifier: .gregorian)
let components = calendar.dateComponents(in: .current, from: date)
let newComponents = DateComponents(calendar: calendar, timeZone: .current, month: components.month, day: components.day, hour: components.hour, minute: components.minute)
let trigger = UNCalendarNotificationTrigger(dateMatching: newComponents, repeats: false)
let content = UNMutableNotificationContent()
content.title = "Tutorial Reminder"
content.body = "Just a reminder to read your tutorial over at appcoda.com!"
content.sound = UNNotificationSound.default()
content.categoryIdentifier = "myCategory"
if let path = Bundle.main.path(forResource: "logo", ofType: "png") {
let url = URL(fileURLWithPath: path)
do …Run Code Online (Sandbox Code Playgroud) 这是我正在使用的图像:

这就是我想要实现的目标:

正如你所看到的,我有一个JPanel外部,GridLayout为(3,1)......即3行1列
我在外部JPanel中添加了3个JPanel,但我遇到的问题只是扩展了Inner2 JPanel.我需要更多空间来在Inner2中添加更多信息,并且需要更少的空间用于Inner3,因为它只有一个CHECKOUT JButton.
我将如何实现这一目标?
我试图在Inner2中设置不同的布局,但似乎所有内部JPanels的维度都是固定的.
首先,我要说的是,我UITableViewController在UITableView.
我的自定义标头类定义如下:
class HeaderCell: UITableViewCell
{
@IBOutlet var theLabel: UILabel!
@IBOutlet var theCountLabel: UILabel!
override func awakeFromNib()
{
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool)
{
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
Run Code Online (Sandbox Code Playgroud)
我像这样加载自定义标头类:
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
{
let headerCell = tableView.dequeueReusableCell(withIdentifier: "HeaderCell") as! HeaderCell
if section == 0
{
headerCell.theLabel.text = "Test 1"
headerCell.theCountLabel.text = String(myArrayOne.count)
} …Run Code Online (Sandbox Code Playgroud) 看来我似乎是唯一一个遇到此问题的人,因为我在SO上没有看到任何人遇到此问题。
但是,在模拟器中使用 iPhone X 截取屏幕截图时,我怎么会出现黑色缺口呢?
这是我正在运行的内容:

然而,当我截取屏幕截图时,我得到了这个:

我什至去了编辑->复制屏幕,但屏幕截图中仍然缺少缺口。
黑色缺口到底在哪里?是否有我需要打开/关闭的设置?...或者这是否正常?
我目前正在运行Xcode 版本 9.2 (9C40b)。
注意:我需要将这些屏幕截图上传到 App Store,因此它们必须包含正确的尺寸尺寸。
我创建了一个尝试返回SubForm数据类型的函数。这个功能被各种家长使用Forms。
该函数如下所示:
Public Function mySubFrm(name As String, subformName As String) As SubForm
Dim frm As Form
Dim subFrm As SubForm
Set frm = Forms(name)
Set subFrm = frm.Controls(subformName)
mySubFrm = subFrm
End Function
Run Code Online (Sandbox Code Playgroud)
我尝试通过以下方式使用它:
Dim testSubForm As SubForm
testSubForm = mySubFrm("testForm", "testSubForm")
Run Code Online (Sandbox Code Playgroud)
立即出现编译错误:
无效使用财产
我试图做的是添加一个手表frm.Controls(subformName),我看到它的返回类型是SubForm/SubForm,所以我觉得我正在声明并设置正确的数据类型,但我又不确定?
有人可以帮助我解决我做得不好的事情吗?
谢谢
ios ×6
swift ×4
swift3 ×3
xcode ×2
grid-layout ×1
java ×1
ms-access ×1
objective-c ×1
python ×1
swing ×1
text ×1
uilabel ×1
uitableview ×1
vba ×1
xcode6 ×1